On dialog

From Scriptwiki
Jump to: navigation, search

The On Dialog event

If a user changes the state of controls in the dialog, eg. clicks on a button, types text in an edit box, etc., this triggers the on dialog script event which allows you to monitor input from the user:

on 1:dialog:name:event:id: {
  echo $dname $devent $did
}

Where name identifies the dialog, id is the id number of the control triggering the event, and event can be:

init	just before a dialog is displayed, controls can be initialized in this event. id is zero.
active when a dialog is activate or deactived (focus is given or removed from the dialog)
close	when a dialog is closed.
edit	text in editbox or combo box changed.
sclick	single click in list/combo box, or check/uncheck of radio/check buttons, or click of a button.
dclick	double click in list/combo box.
menu	a menu item was selected.
scroll	scroll control position has changed.

You can specify multiple ids by using commas and dashes, eg. 1-3,5,7,9,15-20. The ID should be 0 when using init, active, and close.

You can also detect mouse events that aren't associated with a specific control:

mouse	mouse moved
sclick	left button down
uclick	left button up
dclick	double click
rclick	right button click
drop	drop click

You can use $mouse to retrieve the current mouse position.