Plugin:MirLua/Module/m hotkeys: Difference between revisions
Jump to navigation
Jump to search
(transform 'HotkeyItem' structure fields into table) |
(Marked this version for translation) |
||
Line 1: | Line 1: | ||
<languages/> | <languages/> | ||
<translate> | <translate> | ||
<!--T:1--> | |||
Allows you to work with key combinations. | Allows you to work with key combinations. | ||
</translate> | </translate> | ||
Line 9: | Line 10: | ||
<translate> | <translate> | ||
== Functions == | == Functions == <!--T:2--> | ||
</translate> | </translate> | ||
=== Register === | === Register === | ||
<translate>Registers a key combination.</translate> | <translate><!--T:3--> Registers a key combination.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
Line 26: | Line 27: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>table</code> | | style="text-align:center" | <code>table</code> | ||
| <translate><tvar|HotkeyItem>[[#HotkeyItem|HotkeyItem]]</> table.</translate> | | <translate><!--T:4--> <tvar|HotkeyItem>[[#HotkeyItem|HotkeyItem]]</> table.</translate> | ||
|} | |} | ||
Line 32: | Line 33: | ||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | {{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | ||
{{nbsp|5}}<translate>Returns <tvar|true><code>true</code></> if key combination was registered successfully, otherwise <tvar|false><code>false</code></>.</translate> | {{nbsp|5}}<translate><!--T:5--> Returns <tvar|true><code>true</code></> if key combination was registered successfully, otherwise <tvar|false><code>false</code></>.</translate> | ||
==== {{Ls|MirLua/Modules/example}} ==== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
Line 41: | Line 42: | ||
=== Unregister === | === Unregister === | ||
<translate>Removes a key combination.</translate> | <translate><!--T:6--> Removes a key combination.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
Line 54: | Line 55: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| <translate>Key combination name.</translate> | | <translate><!--T:7--> Key combination name.</translate> | ||
|} | |} | ||
Line 60: | Line 61: | ||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | {{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>boolean</code> | ||
{{nbsp|5}}<translate>Returns <tvar|true><code>true</code></> if key combination was removed successfully, otherwise <tvar|false><code>false</code></>.</translate> | {{nbsp|5}}<translate><!--T:8--> Returns <tvar|true><code>true</code></> if key combination was removed successfully, otherwise <tvar|false><code>false</code></>.</translate> | ||
==== {{Ls|MirLua/Modules/example}} ==== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
Line 69: | Line 70: | ||
=== MakeHotkey === | === MakeHotkey === | ||
<translate>Creates key combination.</translate> | <translate><!--T:9--> Creates key combination.</translate> | ||
==== {{Ls|MirLua/Modules/parameters}} ==== | ==== {{Ls|MirLua/Modules/parameters}} ==== | ||
Line 82: | Line 83: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>number</code>, <code>string</code>, <code>table</code> | | style="text-align:center" | <code>number</code>, <code>string</code>, <code>table</code> | ||
| <translate>Modifier key code or name or list of names. Takes values:</translate> | | <translate><!--T:10--> Modifier key code or name or list of names. Takes values:</translate> | ||
* shift = 0x01 | * shift = 0x01 | ||
* control = 0x02 | * control = 0x02 | ||
Line 91: | Line 92: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| <translate>Normal (non-modifier) key.</translate> | | <translate><!--T:11--> Normal (non-modifier) key.</translate> | ||
|} | |} | ||
Line 97: | Line 98: | ||
{{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>number</code> | {{nbsp|5}}{{Ls|MirLua/Modules/type}} <code>number</code> | ||
{{nbsp|5}}<translate>Returns key combination.</translate> | {{nbsp|5}}<translate><!--T:12--> Returns key combination.</translate> | ||
==== {{Ls|MirLua/Modules/example}} ==== | ==== {{Ls|MirLua/Modules/example}} ==== | ||
Line 115: | Line 116: | ||
<translate> | <translate> | ||
== Structures == | == Structures == <!--T:13--> | ||
</translate> | </translate> | ||
=== HotkeyItem === | === HotkeyItem === | ||
<translate>A table describing key combination parameters.</translate> | <translate><!--T:14--> A table describing key combination parameters.</translate> | ||
==== {{Ls|MirLua/Modules/fields}} ==== | ==== {{Ls|MirLua/Modules/fields}} ==== | ||
Line 132: | Line 133: | ||
| style="text-align:center" | {{Ls|YesNo/yes}} | | style="text-align:center" | {{Ls|YesNo/yes}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| <translate>Name of key combination (automatically translated by Core).</translate> | | <translate><!--T:15--> Name of key combination (automatically translated by Core).</translate> | ||
|- | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | Description | ! scope="row" class="MirLuaParametersTable-parameter" | Description | ||
| style="text-align:center" | {{Ls|YesNo/no}} | | style="text-align:center" | {{Ls|YesNo/no}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| <translate>Description of key combination (automatically translated by Core).</translate> | | <translate><!--T:16--> Description of key combination (automatically translated by Core).</translate> | ||
|- | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | Section | ! scope="row" class="MirLuaParametersTable-parameter" | Section | ||
| style="text-align:center" | {{Ls|YesNo/no}} | | style="text-align:center" | {{Ls|YesNo/no}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| <translate>Section name in Miranda hotkey settings. By default plugin name (<tvar|MirLua>MirLua</>) is used.</translate> | | <translate><!--T:17--> Section name in Miranda hotkey settings. By default plugin name (<tvar|MirLua>MirLua</>) is used.</translate> | ||
|- | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | Hotkey | ! scope="row" class="MirLuaParametersTable-parameter" | Hotkey | ||
| style="text-align:center" | {{Ls|YesNo/no}} | | style="text-align:center" | {{Ls|YesNo/no}} | ||
| style="text-align:center" | <code>number</code> | | style="text-align:center" | <code>number</code> | ||
| <translate>Default [[<tvar|link>#MakeHotkey</>|key combination]].</translate> | | <translate><!--T:18--> Default [[<tvar|link>#MakeHotkey</>|key combination]].</translate> | ||
|- | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | Service | ! scope="row" class="MirLuaParametersTable-parameter" | Service | ||
| style="text-align:center" | {{Ls|YesNo/no}} | | style="text-align:center" | {{Ls|YesNo/no}} | ||
| style="text-align:center" | <code>string</code> | | style="text-align:center" | <code>string</code> | ||
| [[Special:MyLanguage/Plugin:MirLua/Module/m_core#CreateServiceFunction|<translate>Service name.</translate>]] | | [[Special:MyLanguage/Plugin:MirLua/Module/m_core#CreateServiceFunction|<translate><!--T:19--> Service name.</translate>]] | ||
|- | |- | ||
! scope="row" class="MirLuaParametersTable-parameter" | Flags | ! scope="row" class="MirLuaParametersTable-parameter" | Flags | ||
| style="text-align:center" | {{Ls|YesNo/no}} | | style="text-align:center" | {{Ls|YesNo/no}} | ||
| style="text-align:center" | <code>number</code> | | style="text-align:center" | <code>number</code> | ||
| <translate>Additional flags.</translate> | | <translate><!--T:20--> Additional flags.</translate> | ||
|} | |} |
Latest revision as of 19:07, 2 June 2018
Allows you to work with key combinations.
Include module: local hotkeys = require('m_hotkeys')
Functions
Register
Registers a key combination.
Parameters
Parameter name | Required | Type | Description |
---|---|---|---|
data | Yes | 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
Parameter name | Required | Type | Description |
---|---|---|---|
name | Yes | 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
Parameter name | Required | Type | Description |
---|---|---|---|
modifier | Yes | number , string , table
|
Modifier key code or name or list of names. Takes values:
|
key | Yes | 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')
local hk = hotkeys.MakeHotkey('ctrl', 'A')
local hk = hotkeys.MakeHotkey({ 'ctrl', 'alt' }, 'A')
Structures
HotkeyItem
A table describing key combination parameters.
Fields
Field name | Required | Type | Description |
---|---|---|---|
Name | Yes | string
|
Name of key combination (automatically translated by Core). |
Description | No | string
|
Description of key combination (automatically translated by Core). |
Section | No | string
|
Section name in Miranda hotkey settings. By default plugin name (MirLua) is used. |
Hotkey | No | number
|
Default key combination. |
Service | No | string
|
Service name. |
Flags | No | number
|
Additional flags. |