Vizard 7 » Command Index » Vizard modules » vizact » <vizact>.onmousedown
7.5

<vizact>.onmousedown

Registers a function to handle mouse down events

<vizact>.onmousedown(  
button  
func  
*args  
)  
button
The mouse button to handle
func
The function to call when the mouse button is pressed
*args
The arguments to pass to the function

Remarks

This command will call the given function when the specified mouse button is pressed.

Return Value

A vizact.EventFunction object with the following methods:

Method

Description

<event>.setEnabled(val)

Enable/Disable the event function. The associated function will not be called while the event function is disabled. viz.TOGGLE can be used to toggle the state. Event functions are initially enabled.

<event>.getEnabled()

Get the enabled state of the event function.

<event>.remove()

Permanently unregister the event function.

Example

#Quit the simulation when the right mouse button is pressed
vizact.onmousedown(viz.MOUSEBUTTON_RIGHT,viz.quit)

See also

<vizact>.onmouseup
<vizact>.onpick
<vizact>.onwheeldown
<vizact>.onwheelup
<vizact>.whilemousedown