Selection removed by SetGadgetItemText?

Just starting out? Need help? Post your questions and find answers here.
Kai
New User
New User
Posts: 4
Joined: Mon Mar 05, 2007 7:34 pm

Selection removed by SetGadgetItemText?

Post by Kai »

Hello, small question, if I change an entry in the ComboBoxGadget with SetGadgetItemText the selectierte entry again removed. is that a Bug?

Code: Select all

If OpenWindow(0, 0, 0, 200, 200, "Test", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) <> 0
 If CreateGadgetList(WindowID(0)) <> 0
  ComboBoxGadget(0, 5, 5, 190, 180)
 EndIf
EndIf

For x = 0 To 10: AddGadgetItem(0, -1, Str(x)): Next
SetGadgetState(0, 2)
Debug GetGadgetState(0)
For x = 0 To 10: SetGadgetItemText(0, x, "Changed " + Str(x), 0): Next
Debug GetGadgetState(0)

While WaitWindowEvent() <> #PB_Event_CloseWindow: Wend
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post by netmaestro »

If you do a SetGadgetText on items other than the selected item, it isn't affected. If you change the text of the item that's selected, it won't be selected anymore. Does that behavior make sense, or does it seem like a bug to you? It seems to me that there's some logic to the way it works, but to someone else, maybe not.
BERESHEIT
Post Reply