PDA

View Full Version : about checkbox


haohaoxuexi1
03-15-2017, 01:05 PM
def onButton_trigger(obj,state):

#judgement for x axis
if obj == r_checkbox_x:
if state == viz.DOWN:
print "state=down"

else:
print "state=up"

#judgement for y axis
if obj == r_checkbox_y:
if state == viz.DOWN:
print "state=down"

else:
print "state=up"

#judgement for z axis
if obj == r_checkbox_z:
if state == viz.DOWN:
print "state=down"

else:
print "state=up"

viz.callback(viz.BUTTON_EVENT, onButton_trigger)



is that possible to set up some limit to guarantee that there is only one "obj" to be checked?

For example, when obj == r_checkbox_z state is down, the states of obj == r_checkbox_x, obj == r_checkbox_y are up.

The states of the three cannot be "up" at the same time.

Thanks,

Jeff
03-16-2017, 02:16 AM
Yes, each time one checkbox is changed by the user, you could use the button.set (http://docs.worldviz.com/vizard/#commands/node3d/GUI/button/set.htm) command to change the states of the other checkboxes.

haohaoxuexi1
03-17-2017, 11:50 AM
Yes, each time one checkbox is changed by the user, you could use the button.set (http://docs.worldviz.com/vizard/#commands/node3d/GUI/button/set.htm) command to change the states of the other checkboxes.

works well.

thanks,