Plugin:MirLua/Module/m hotkeys

From Miranda NG
< Plugin:MirLua
Revision as of 13:59, 28 December 2015 by RMN (talk | contribs) (Plugin:MirLua/en/m_hotkeys (from ru))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Allows you to work with key combinations.

Include module: local hotkeys = require('m_hotkeys')

<translate> Note</translate>
Parameters written in bold italics are obligatory.


Functions

Register

Registers a key combination.

Parameters
data
Type: table
HotkeyItem table.
Result
Type: boolean
Returns true if key combination was registered successfully, otherwise false.
Example
local hIcon = hotkeys.Register({ Name = 'hkUniqueName' })

Unregister

Removes a key combination.

Parameters
name
Type: string
Key combination name.
Result
Type: boolean
Returns true if key combination was removed successfully, otherwise false.
Example
hotkeys.Unregister('hkUniqueName')

MakeHotkey

Creates key combination.

Parameters
modifier
Type: number
Modifier key codes:
shift = 0x01
control = 0x02
alt = 0x04
win = 0x08
key
Type: string
Normal (non-modifier) key.
Result
Type: number
Returns key combination.
Example
local HOTKEYF_SHIFT = 0x01
local HOTKEYF_ALT = 0x04
local hk = hotkeys.MakeHotkey(HOTKEYF_SHIFT | HOTKEYF_ALT, 'A')


Structures

HotkeyItem

A table describing key combination parameters.

Fields
Name
Type: string
Name of key combination (automatically translated by Core).
Description
Type: string
Description of key combination (automatically translated by Core).
Section
Type: string
Section name in Miranda hotkey settings. By default plugin name (MirLua) is used.
Hotkey
Type: number
Default key combination.
Service
Type: string
Service name.
Flags
Type: number
Additional flags.