pyui.set_on_click_handler - pytha-3d-cad/pytha-lua-api GitHub Wiki
Sets the on_click handler function for controls that support this event. The click event is usually invoked when the user clicks (presses and releases a pointing device) on the control.
pyui.set_on_click_handler(control, func)
control:set_on_click_handler(func)
Parameters
| Type | Description | |
|---|---|---|
control |
control_handle |
A control handle returned by one of the pyui.create_xxx control creation functions |
func |
function |
A lua function that is invoked for every change event |
Return value
| Type | Description |
|---|---|
control_handle |
The control handle is returned again |
Note:
This handler is specific to the current modal environment / dialog and can only be set within a dialog.
The parameters to the on_click handler differ slightly depending on the control on which it is used
function on_click_handler([state])
| Type | Description | |
|---|---|---|
state |
boolean |
The new state of the control (if applicable) |
A useful pattern is to write the handler function inline
local text_box = pyui.create_text_box(2)
text_box:set_on_change_handler(function(text)
-- do something with the new content: text
end)
Version requirements
This function is available in V26 and above.
See also
Control Gallery, set_on_change_handler, create_button, create_check_box, create_radio_button