Restored from previous forum. Originally posted by Jose.
Hi all,
Having a little problem with ComboBoxGadget() in edit mode, the code beneath should show the problem, if you use the TAB key to get into the ComboBoxGadget(), then use the keyboard or mouse to select items of type in new value, you'll see the thing work (cool), but try TAB out of ComboBoxGadget and it fails.
I have tried adding a shortcut key, in the same way as the Enter/return is done, but this fails. Have not found an answer in any code possted here yet, help please.
So my question, how can I TAB or Shift-TAB out of a ComboBoxGadget to another gadget or even just detect that this key has been pressed would help.
If OpenWindow(0, (GetSystemMetrics_(#SM_CXSCREEN)-300)/2,(GetSystemMetrics_(#SM_CYSCREEN)-300)/2,300,300, #PB_Window_MinimizeGadget, "ComboBoxGadget-Test")
CreateGadgetList(WindowID())
TextGadget(3,5,40,200,17,"Hello")
StringGadget(5, 5, 65, 200, 20, "testing TAB")
ComboBoxGadget(4, 5, 5, 100, 120, #PB_ComboBox_Editable)
AddGadgetItem(4, -1, "Apples")
AddGadgetItem(4, -1, "Bannas")
AddGadgetItem(4, -1, "Cheries")
AddGadgetItem(4, -1, "Grapes")
AddGadgetItem(4, -1, "Pears")
AddKeyboardShortcut(0, #PB_Shortcut_Return, 10)
;;;;; AddKeyboardShortcut(4, #PB_Shortcut_Tab, 11) ; Not working, should not work!!!
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadgetID()
Case 4
SetGadgetText(3, GetGadgetText(4))
; Something
EndSelect
Case #PB_Event_Menu ; We only have one shortcut
SetGadgetText(5, GetGadgetText(4)+"[State="+Str(GetGadgetState(4))+"]")
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
End
Thanks
Jose
Registered PureBasic User, 2.60-)
ComboBoxGadget TAB problem
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by El_Choni.
This works here:
Maybe a bit tricky? You'll tell us. Bye,
El_Choni
This works here:
Code: Select all
If OpenWindow(0,(GetSystemMetrics_(#SM_CXSCREEN)-300)/2,(GetSystemMetrics_(#SM_CYSCREEN)-300)/2,300,300,#PB_Window_MinimizeGadget, "ComboBoxGadget-Test")
If CreateGadgetList(WindowID())
TextGadget(3,5,40,200,17,"Hello")
StringGadget(5, 5, 65, 200, 20, "testing TAB")
ComboBoxGadget(4, 5, 5, 100, 120, #PB_ComboBox_Editable)
AddGadgetItem(4, -1, "Apples")
AddGadgetItem(4, -1, "Bannas")
AddGadgetItem(4, -1, "Cheries")
AddGadgetItem(4, -1, "Grapes")
AddGadgetItem(4, -1, "Pears")
EndIf
AddKeyboardShortcut(0, #PB_Shortcut_Return, 10)
AddKeyboardShortcut(0, #PB_Shortcut_Tab, 11) ; Not working, should not work!!!
Repeat
Event = WaitWindowEvent()
Select Event
Case #PB_Event_Gadget
Select EventGadgetID()
Case 4
SetGadgetText(3, GetGadgetText(4))
; Something
EndSelect
Case #PB_Event_Menu ; We only have one shortcut
Select EventMenuID()
Case 10
SetGadgetText(5, GetGadgetText(4)+"[State="+Str(GetGadgetState(4))+"]")
Case 11
If GetFocus_()=GadgetID(5)
ActivateGadget(4)
Else
ActivateGadget(5)
EndIf
EndSelect
EndSelect
Until Event=#PB_Event_CloseWindow
EndIf
End
El_Choni
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm