Updating a table dynamically

Present your own projects here, be they WIPs, betas or finished products. Get feedback from others and help each other out with some lovely testing.

Updating a table dynamically

Postby Babu » Wed Mar 13, 2019 7:54 am

I'm currently creating an inventory system in which the user can select an item from their inventory list collection, and the icon on the right will update.

As of now, I've implemented a ClickListener to get the current selected item from the inventory list, and called the .getImage() method that I created to get the icon of the selected item.

I used table.add(image); to add the icon to the table. However, when the icon is added to the table, it fills up that space, and another column is created when the user selects on another item.

How do I get the image area to update when the user selects another item, rather than creating another column to the right?
Babu
 
Posts: 2
Joined: Wed Mar 13, 2019 7:51 am

Re: Updating a table dynamically

Postby bmanmcfly » Thu Jun 20, 2019 10:14 pm

I had a similar problem some time ago; not sure how you are setup, but I was using drag and drop to move inventory to equipment and all, but it would not update properly.

Instead of using the actors, what I did was to use a description of the item needed and if it moved to a new cell, would delete the previous actor and use the description to create a new one. I had also changed it so that the inventory was never saved as a group of actors, but a group of descriptions to build the actors (item type, quantity, etc) and each time the window was closed would clear the table and would create the entities by their descriptions when the inventory was opened.

I forget the reason why it had to be done like that, evilentity had explained the issue in technical detail. Something like a single actor can't belong to multiple cells.
bmanmcfly
 
Posts: 37
Joined: Fri Oct 30, 2015 4:09 am

Re: Updating a table dynamically

Postby quintero » Sun Jul 14, 2019 8:28 am

Got it!
quintero
 
Posts: 1
Joined: Sun Jul 14, 2019 8:25 am


Return to Showcase

Who is online

Users browsing this forum: No registered users and 1 guest

cron