Page 1 of 1

Selection removed by SetGadgetItemText?

Posted: Sat May 26, 2007 4:57 pm
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

Posted: Sat May 26, 2007 5:04 pm
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.