ShortcutGadget()

Syntax

Result = ShortcutGadget(#Gadget, x, y, Width, Height, Shortcut)
Description
Creates a gadget for keyboard shortcut selection in the current GadgetList. The user can select it and hold down a keyboard combination to select a new shortcut.

Parameters

#Gadget A number to identify the new gadget. #PB_Any can be used to auto-generate this number.
x, y, Width, Height The position and dimensions of the new gadget.
Shortcut The initial shortcut to display. The possible values are the same as in the AddKeyboardShortcut() function. A value of 0 can be used to indicate that no shortcut is currently set.

Return value

Returns nonzero on success and zero on failure. If #PB_Any was used as the #Gadget parameter then the return-value is the auto-generated gadget number on success.

Remarks

A 'mini help' can be added to this gadget using GadgetToolTip().

The following functions can be used to act on a ShortcutGadget:

- GetGadgetState(): Get the currently selected keyboard shortcut.
- SetGadgetState(): Change the currently selected keyboard shortcut.

Example

  If OpenWindow(0, 0, 0, 240, 70, "ShortcutGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    ShortcutGadget(0, 20, 20, 200, 25, #PB_Shortcut_Control | #PB_Shortcut_A)
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

See Also

GetGadgetState(), SetGadgetState(), AddKeyboardShortcut()

Supported OS

All

<- SetGadgetText() - Gadget Index - SpinGadget() ->