is there a code somewhere to do this?
Thanks!
Code: Select all
UsePNGImageDecoder()
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png")
If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ComboBoxGadget(2, 10, 70, 250, 21, #PB_ComboBox_Editable)
For a = 1 To 5
AddGadgetItem(2, -1,"ComboBox item " + Str(a))
Next
SetGadgetState(2, 2) ; set (beginning with 0) the third item as active one
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget And EventGadget()=2
Debug "Gadget 2 is now -> "+GetGadgetText(2)
EndIf
Until ev = #PB_Event_CloseWindow
EndIf
Code: Select all
UsePNGImageDecoder()
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png")
If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ComboBoxGadget(2, 10, 70, 250, 30)
For a = 0 To 5
AddGadgetItem(2, -1,"ComboBox item " + Str(a))
Next
SetGadgetState(2, 2) ; set (beginning with 0) the third item as active one
olditem = GetGadgetState(2)
Repeat
Select WaitWindowEvent(1)
Case 0
If GetGadgetState(2) <> olditem
Debug "item changed"
Debug GetGadgetState(2)
olditem = GetGadgetState(2)
EndIf
Case #PB_Event_CloseWindow
quit = 1
EndSelect
Until Quit = 1
EndIf
Code: Select all
UsePNGImageDecoder()
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png")
If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ComboBoxGadget(2, 10, 70, 250, 21)
For a = 1 To 5
AddGadgetItem(2, -1,"ComboBox item " + Str(a))
Next
SetGadgetState(2, 2) ; set (beginning with 0) the third item as active one
oldtxt$ = GetGadgetText(2)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 2
If GetGadgetText(2) <> oldtxt$
Debug "Select item changed"
oldtxt$ = GetGadgetText(2)
EndIf
EndSelect
EndSelect
Until Quit = 1
EndIf
Code: Select all
If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ComboBoxGadget(0, 10, 70, 250, 21)
For a = 1 To 5
AddGadgetItem(0, -1, "ComboBox item " + Str(a))
Next
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case 0
If EventType() = #PB_EventType_Change
Debug "Now selected -> " + GetGadgetText(0)
EndIf
EndSelect
EndSelect
ForEver
EndIfWell, it still works here; I only added the editable flag because I thought you wanted it. Here it is working without it (like HeX0R):Quin wrote: Wed May 28, 2025 4:48 amSure, but only if you use the editable combo box.
Remove the editable flag, and it no longer works.
Code: Select all
UsePNGImageDecoder()
LoadImage(0, #PB_Compiler_Home + "examples/sources/Data/world.png")
If OpenWindow(0, 0, 0, 270, 180, "ComboBoxGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ComboBoxGadget(2, 10, 70, 250, 21)
For a = 1 To 5
AddGadgetItem(2, -1,"ComboBox item " + Str(a))
Next
SetGadgetState(2, 2)
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget And EventGadget()=2
Debug "Gadget 2 is now -> "+GetGadgetText(2)
EndIf
Until ev = #PB_Event_CloseWindow
EndIf
You wouldn't believe how many times I was about to post a bug until I tried it in a small standalone snippet... where it worked. So, I feel your pain.Quin wrote: Wed May 28, 2025 1:33 pmIt doesn't work in my large application, but it does in this small test.
Hahaha yup, been there, done that. I normally do the exact same thing, but trying this with my unbounded implementation and seeing it not work, plus the docs saying it only happens when you change the selection of the edit field when I was tired, made me go screw it and post the "bug".