To pull user input from buttons, boxes and sliders, you can call them directly or set up a callback that gets triggered by new input.
Use <GUI element>.get() to get the data from a button, check box or slider.
If <GUI element> is a button or a checkbox, the command will return a '0' if the button is down and '1' if it's up.
If <GUI element> is a slider, the command will return the tick's position along the bar.
If you want to know if the user is currently moving the tick on a slider, use <slider>.dragging(). If the user is dragging the tick, the command will return a '1'.
data = mySlider.get() #Get
the tick location.
isDragging = mySlider.dragging() #Is
the tick dragging?
The <GUI element>.get() command will give you the typed input from a textbox. You can also get the cursor location in the textbox using <text box>.getCursorPos().
myTextBox = viz.addTextbox()
myTextBox.get() #Get the text in the
box.
myTextBox.getCursorPos() #Get the
position of the cursor.
Use <droplist>.getSelection() to get the index of the current selection on the droplist. Note: since this command will only give you the current index, you can use <droplist>.getItems() to find out the whole array of items and then use the index to pick out the value of the selected item.
#Find the index of the current selection.
drop.getSelection()
#Find the selection itself.
drop.getItems()[ drop.getSelection() ]
The action library has methods of registering callback functions for GUI callback events. The commands <vizact>.onbuttondown, <vizact>.onbuttonup, <vizact>.onslider, <vizact>.onlist, and <vizact>.ontextbox will handle the following events.
Button events (viz.BUTTON_EVENT) : triggered by checkboxes, buttons, radio buttons, or clicking on a drop-down menu.
Slider events (viz.SLIDER_EVENT) : triggered by sliders and progress bars.
List events (viz.LIST_EVENT) : triggered when someone makes a new choice from a drop-down menu (but not when the current selection is re-selected).
Textbox events (viz.TEXTBOX_EVENT) : triggered when text is entered in a text box.
Getting data from GUI elements
viztip