Skip to content

3.02 GUI variables

Lokasenna edited this page Jul 17, 2018 · 2 revisions

GUI.mouse.x, GUI.mouse.y

Updated on every loop with the mouse coordinates, relative to the script window. Identical to gfx.mouse_x, gfx.mouse_y.

GUI.mouse.cap

Updated on every loop with the state of Ctrl, Shift, Alt, etc. Identical to gfx.mouse_cap.

1       Left mouse button
2       Right mouse button
4       Control key
8       Shift key
16      Alt key
32      Windows key
64      Middle mouse button

Values can be checked using bitwise comparison: if GUI.mouse.cap & 8 == 8 then shift_is_pressed end.

GUI.mouse.wheel

Updated on every loop with the position (relative to the last value) of the mouse wheel. Shouldn't need to be accessed directly; all GUI elements receive a value, inc, when :onwheel is called. Identical to gfx.mouse_wheel.

GUI.mouse_down_elm

While a mouse button is down, these store the element that was clicked.

Also: rmouse_down_elm, mmouse_down_elm.

GUI.mouse.ox, GUI.mouse.oy

When the mouse is being dragged (i.e. an element's :ondrag logic is being called), these store the the mouse's original coordinates in the script window.

Also: r_ox, r_oy, m_ox, m_oy.

GUI.mouse.off_x, GUI.mouse.off_y

When the mouse is being dragged these store the mouse's original position relative to the element being dragged. i.e. If the element was at 32,32 , and the mouse was pressed down at 64,48, off_x and off_y would be 32,16.

Also: r_off_x, r_off_y, m_off_x, m_off_y.

GUI.char

Updated on every loop with the keyboard state. Identical to calling gfx.getchar().

GUI.escape_bypass

Boolean. When set to true, pressing Esc will not close the script window. Use this if your script needs to use Esc for something itself.

GUI.SWS_exists

Boolean. True if the SWS extension is available (currently only SWS v2.9.7 or newer).

GUI.script_restricted

Boolean. True if the script is running in "restricted permissions" mode.

GUI.tooltip_time

Number. Specifies the delay time when the mouse is hovered over an element before a tooltip is shown (if GUI.elms.my_elm.tooltip = "Hello!" is specified).