uvi-script
Musical event scripting with Lua
Loading...
Searching...
No Matches
ModifierKeys Class Reference

Keyboard modifier key state information. More...

Public Attributes

bool altDown
 True if the ALT key (Option on macOS) is pressed.
 
bool commandDown
 True if the Command key (macOS) or Ctrl key (Windows/Linux) is pressed.
 
bool shiftDown
 True if the Shift key is pressed.
 

Detailed Description

Keyboard modifier key state information.

Provides information about which modifier keys (Alt, Command/Ctrl, Shift) are pressed when a widget's changed callback is triggered. This allows scripts to implement different behaviors based on modifier key combinations.

Availability: Modifier key information is passed as the second parameter to the changed callback for Button, OnOffButton, and MultiStateButton widgets.

Usage Example:

local button = Button("MyButton")
button.changed = function(self, mods)
if mods.shiftDown then
print("Shift-clicked!")
elseif mods.commandDown then
print("Command/Ctrl-clicked!")
elseif mods.altDown then
print("Alt-clicked!")
else
print("Normal click")
end
end
stateless transient button.
Definition ui.cpp:804
bool altDown
True if the ALT key (Option on macOS) is pressed.
Definition ui.cpp:745
bool commandDown
True if the Command key (macOS) or Ctrl key (Windows/Linux) is pressed.
Definition ui.cpp:746
bool shiftDown
True if the Shift key is pressed.
Definition ui.cpp:747
Note
On macOS, commandDown represents the Command key (⌘). On Windows and Linux, it represents the Ctrl key.
See also
Button, OnOffButton, MultiStateButton