SetActiveGadget()
Syntax
SetActiveGadget(#Gadget)Description
Activates (sets the keyboard focus on) the gadget specified by the given gadget number. Activating a gadget allows it to become the current object to receive messages and handle keystrokes.
Parameters
#Gadget The gadget to activate. Can be set to '-1' to remove the keyboard focus from the current active window.
Return value
None.
Example
If OpenWindow(0, 0, 0, 270, 140, "SetActiveGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) StringGadget (0, 10, 10, 250, 20, "bla bla...") ComboBoxGadget(1, 10, 40, 250, 21) For a = 1 To 5 : AddGadgetItem(1, -1, "ComboBox item " + Str(a)) : Next SetGadgetState(1, 2) ; set (beginning with 0) the third item as active one ButtonGadget (2, 10, 90, 250, 20, "Activate StringGadget") ButtonGadget (3, 10, 115, 250, 20, "Activate ComboBox") Repeat Event = WaitWindowEvent() If Event = #PB_Event_Gadget Select EventGadget() Case 2 : SetActiveGadget(0) ; Activate StringGadget Case 3 : SetActiveGadget(1) ; Activate ComboBoxGadget EndSelect EndIf Until Event = #PB_Event_CloseWindow EndIf
See Also
GetActiveGadget(), SetActiveWindow()
Supported OS
All