Best way to link items from a list box to objects?

BlitzMax Forums/MaxGUI Module/Best way to link items from a list box to objects?

Ryan Burnside(Posted 2009) [#1]
I'm working on a utility that saves score data for older games.

Each score is a unique object that has a name,score and level reached.

Now I'm using list boxes to represent them. What is the best way to link them to the actual scores so when I delete the listbox item, I also delete the object that it draws its text from? The score items are stored in a Tlist. Then iterated through and their data added to the listbox gadget.


SebHoll(Posted 2009) [#2]
Use the extra parameter of AddGadgetItem(), InsertGadgetItem() or ModifyGadgetItem() to associate an object with a gadget item. You can later retrieve this item using GadgetItemExtra(). These object pointers will be nullified when the item is removed or when the gadget is freed.


Ryan Burnside(Posted 2009) [#3]
Ah I will try it! Thank you so much.