Code : Tout sélectionner
;- Window Constants
Enumeration
#Window
EndEnumeration
;- Gadget Constants
Enumeration
#Combo
#String_1
#String_2
#String_3
#String_4
#Button
EndEnumeration
Global hCombo
Procedure Open_Window()
If OpenWindow(#Window, 496, 78, 315, 175, #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "Test")
If CreateGadgetList(WindowID())
ComboBoxGadget(#Combo, 10, 10, 295, 200, #PB_ComboBox_Editable)
StringGadget(#String_1, 10, 50, 295, 20, "")
StringGadget(#String_2, 10, 75, 295, 20, "")
StringGadget(#String_3, 10, 100, 295, 20, "")
StringGadget(#String_4, 10, 125, 295, 20, "")
ButtonGadget(#Button, 115, 150, 100, 20, "Bouton")
EndIf
EndIf
RemoveKeyboardShortcut(#Window, #PB_Shortcut_All)
AddKeyboardShortcut(#Window, #PB_Shortcut_Tab, #PB_Shortcut_Tab)
EndProcedure
Procedure EnumChildProc(hwnd, lParam)
Result = #True
Class$ = Space(128) : GetClassName_(hwnd, @Class$, 128)
If LCase(Class$) = "edit"
hCombo = hwnd : Result = #False
EndIf
EnumChildWindows_ (hwnd, @EnumChildProc(), lParam)
ProcedureReturn Result
EndProcedure
;/ Ouverture de la fenêtre
Open_Window()
ActivateGadget(#Combo)
;/ On va chercher le 'handle' de l'Edit qui se trouve dans la ComboBox
;/ Le handle est global, et n'est recherché qu'une fois, à l'ouverture
;/ du programme
EnumChildWindows_(GadgetID(#Combo),@EnumChildProc(),0)
Repeat
Select WaitWindowEvent()
Case #PB_EventMenu
Select EventMenuID()
Case #PB_Shortcut_Tab
;/ Et on a plus qu'à utiliser GetFocus_()
Focus = GetFocus_()
Select Focus
Case hCombo : ActivateGadget(#String_1)
Case GadgetID(#String_1) : ActivateGadget(#String_2)
Case GadgetID(#String_2) : ActivateGadget(#String_3)
Case GadgetID(#String_3) : ActivateGadget(#String_4)
Case GadgetID(#String_4) : ActivateGadget(#Combo)
EndSelect
EndSelect
Case #PB_EventGadget
Select EventGadgetID()
Case #Combo
Case #String_1
Case #String_2
Case #String_3
Case #String_4
EndSelect
Case #PB_EventCloseWindow
Quit = 1
EndSelect
Until Quit
End