Vizard 8 » Command Index » Vizard modules » vizact » <vizact>.onlist
8.0

<vizact>.onlist

Register a function to handle events from a drop down list

<vizact>.onlist(  
droplist  
func  
*args  
)  
droplist
A droplist object
func
The function to call when the droplist selection changes
*args
The arguments to pass to the function

Remarks

The function will be called when a new selection is made for the drop down list. The first argument passed to the callback func is an event object that has a newSel attribute.

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

droplist = viz.addDropList( options=['Hello','World'] , pos=(0.5,0.5,0) )
def dropListChanged(e):
    print(e.object.getItem(e.newSel))
vizact.onlist( droplist, dropListChanged )

See also

<vizact>.onbuttondown
<vizact>.onbuttonup
<vizact>.onslider
<vizact>.ontextbox