proc wHotkeyToString(hotkey: tuple[modifiers: int, keyCode: int]): string {...}{.
raises: [KeyError], tags: [].}
-
Helper function to convert from hotkey to string. Returns "" if failed.
proc wStringToHotkey(value: string): tuple[modifiers: int, keyCode: int] {...}{.raises: [],
tags: [].}
-
Helper function to convert from string to hotkey. Returns (0, 0) if failed.
proc getHotkey(self: wHotkeyCtrl): tuple[modifiers: int, keyCode: int] {...}{.inline,
raises: [], tags: [].}
-
Gets the modifiers and keyCode of the current hotkey. Modifiers is a bitwise combination of wModShift, wModCtrl, wModAlt, wModWin.
proc getValue(self: wHotkeyCtrl): string {...}{.inline, raises: [], tags: [].}
-
Gets the text of current hotkey.
proc getClearKey(self: wHotkeyCtrl): int {...}{.inline, raises: [], tags: [].}
-
Gets the key code that clears current content. The default key is Esc.
proc changeHotkey(self: wHotkeyCtrl; modifiers: int; keyCode: int) {...}{.
raises: [KeyError], tags: [].}
-
Sets current hotkey by given modifiers and keyCode. This functions does not generate the wEvent_HotkeyChanged event.
proc changeHotkey(self: wHotkeyCtrl; hotkey: tuple[modifiers: int, keyCode: int]) {...}{.
inline, raises: [KeyError], tags: [].}
-
Sets current hotkey. This functions does not generate the wEvent_HotkeyChanged event.
proc setHotkey(self: wHotkeyCtrl; modifiers: int; keyCode: int) {...}{.
raises: [KeyError, Exception], tags: [RootEffect].}
-
Sets current hotkey by given modifiers and keyCode. This function generates a wEvent_HotkeyChanged event. To avoid this you can use changeHotkey() instead.
proc setHotkey(self: wHotkeyCtrl; hotkey: tuple[modifiers: int, keyCode: int]) {...}{.inline,
raises: [KeyError, Exception], tags: [RootEffect].}
-
Sets current hotkey. This function generates a wEvent_HotkeyChanged event. To avoid this you can use changeHotkey() instead.
proc changeValue(self: wHotkeyCtrl; value: string) {...}{.inline, raises: [KeyError],
tags: [].}
-
Sets current hotkey by given text (case-insensitive and ignored spaces). This functions does not generate the wEvent_HotkeyChanged event.
proc setValue(self: wHotkeyCtrl; value: string) {...}{.inline,
raises: [KeyError, Exception], tags: [RootEffect].}
-
Sets current hotkey by given text (case-insensitive and ignored spaces). This function generates a wEvent_HotkeyChanged event. To avoid this you can use changeValue() instead.
proc setClearKey(self: wHotkeyCtrl; clearKey: int) {...}{.inline, raises: [], tags: [].}
-
Sets a key to clear current content. The default key is Esc. If more keys are needed, you can do it by handling wEvent_HotkeyChanging. For example:
hotkeyCtrl.wEvent_HotkeyChanging do (event: wEvent):
let hotkey = event.getHotkey()
if hotkey.modifiers == 0 and hotkey.keyCode in {wKey_Esc, wKey_Delete, wKey_Back}:
hotkeyCtrl.hotkey = (0, 0)
event.veto
proc init(self: wHotkeyCtrl; parent: wWindow; id = wDefaultID; value: string = "";
pos = wDefaultPoint; size = wDefaultSize; style: wStyle = wHkLeft) {...}{.raises: [
wNilAccess, wWindowError, wCursorError, wBrushError, Exception, IndexDefect,
wFontError, KeyError], tags: [RootEffect].}
-
Initializes a hotkey control.
proc HotkeyCtrl(parent: wWindow; id = wDefaultID; value: string = ""; pos = wDefaultPoint;
size = wDefaultSize; style: wStyle = wHkLeft): wHotkeyCtrl {...}{.inline,
discardable, raises: [wNilAccess, wWindowError, wCursorError, wBrushError,
Exception, IndexDefect, wFontError, KeyError],
tags: [RootEffect].}
-
Constructor.