PDA

View Full Version : about setPosition


xingxing
02-19-2008, 09:41 PM
I'm trying to use vizinfo and textbox to establish a form. I wanna some textboxes arranged on the vizinfobox on certain positions. e.g. horizontallly, not vertically, ordered. This is hard because the setPosition attribute can only change the position of label of textbox and the position of the input field can't be changed in this way. Can any experts tell me whether I can do it in this way?
If yes, how can I do it?

Regards

xingxing
02-20-2008, 02:01 AM
I'm trying to use vizinfo and textbox to establish a form. I wanna some textboxes arranged on the vizinfobox on certain positions. e.g. horizontallly, not vertically, ordered. This is hard because the setPosition attribute can only change the position of label of textbox and the position of the input field can't be changed in this way. Can any experts tell me whether I can do it in this way?
If yes, how can I do it?

Regards

the format I used is like the following.

Tbox = viz.add(viz.TEXTBOX, 'tb')
Tbox.setPosition(.2,.2)

Gladsomebeast
02-20-2008, 10:32 AM
I would avoid using the vizinfo feature for detailed control over GUI elements.

Try manualy aranging the gui. Here is some sample code. Because the elements are under the viz.ORTHO parent, there positions are specified in pixels.

guiRoot = viz.addGroup(parent=viz.ORTHO)
viz.link(viz.CenterTop, guiRoot)

buttonRoot = viz.addGroup(parent=guiRoot, pos=(0, -100, 0))
button = viz.addButton(parent=buttonRoot, pos=(200,0,0), scale=[1]*3)
label = viz.addText('Toggle HUD', parent=button, pos=(-50,25,0), scale=[25]*3)

button = viz.addButton(parent=buttonRoot, pos=(0,0,0), scale=[1]*3)
label = viz.addText('Set Background', parent=button, pos=(-50,25,0), scale=[25]*3)