at the moment I'm writing a database application with many ListIconGadgets.
As ItemData I store always the ID of the record.
Suddenly I had the need to store an additional boolean value which should not be shown in the ListIconGadget.
Ok, I can use the ItemData to store a pointer to a struct.
But that was to much effort.
After a bit of thinking and testing, it results in:
Code: Select all
OpenWindow(0, 0, 0, 300, 300, "Dirty Trick", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ListIconGadget(0, 10, 10, 210, 280, "Dummy", 200)
For i = 0 To 9
AddGadgetItem(0, i, "Dummy " + Str(i + 1))
SetGadgetItemData(0, i, i)
If (i + 1) % 2
SetGadgetItemColor(0, i, #PB_Gadget_FrontColor, 0)
EndIf
Next i
ListIconGadget(1, 230, 10, 60, 100, "Values", 50)
Exit = #False
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
If EventType() = #PB_EventType_Change
ClearGadgetItems(1)
AddGadgetItem(1, -1, Str(GetGadgetItemData(0, GetGadgetState(0))))
If GetGadgetItemColor(0, GetGadgetState(0), #PB_Gadget_FrontColor) = 0
AddGadgetItem(1, -1, "Odd")
Else
AddGadgetItem(1, -1, "Even")
EndIf
EndIf
Case #PB_Event_CloseWindow : Exit = #True
EndSelect
Until Exit

Normally this value is -1.
Hm, I don't think that someone sees the difference from $010101 to $000000.
So you can store 3 additional boolean values



Bernd