WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   vizinfo text alignment (https://forum.worldviz.com/showthread.php?t=2101)

hosier 06-18-2009 05:59 PM

vizinfo text alignment
 
I've created a help menu using vizinfo. I then have another function that changes the message of the menu so that I can present the instructions in other languages.

When the help menu first comes up, the text is aligned to the left side of the vizinfo box. When I change the text of the menu, it shifts to the right side of the box.

I'm creating my menu thus:
Code:

# Setup Help Menu
tempmessage  = "Help:\n"
tempmessage += "Select a muscle to closer examine it\n"
tempmessage += "Use the arrow keys to move the selected muscle\n"
tempmessage += "Use the right mouse button to rotate the selected muscle\n"
tempmessage += "Use + to zoom in and - to zoom out on the selected muscle\n"
tempmessage += "Press h to turn help on/off\n"
tempmessage += "Press r to reset the model\n"

HELPMESSAGE["eng"] = tempmessage


tempmessage  = "Ayuda:\n"
tempmessage += "Seleccione un m�culo m� cerca para examinarlo\n"
tempmessage += "Utilice las llaves de flecha para mover el m�culo seleccionado\n"
tempmessage += "Utilice el bot� de rat� derecho para girar el m�culo seleccionado\n"
tempmessage += "Uso + enfocar adentro y - enfocar hacia fuera en el m�culo seleccionado\n"
tempmessage += "Presione h para dar vuelta a ayuda con./desc.\n"
tempmessage += "Presione r para reajustar el modelo\n"

HELPMESSAGE["spa"] = tempmessage



helpmenu = vizinfo.add(HELPMESSAGE["eng"])
helpmenu.shrink()
helpmenu.visible(viz.OFF)

I then create a function attached to a select list:
Code:

def languageradio(name,status):
        global language
        global helpmenu
        global HELPMESSAGE

        language = name
        print "Language: " + language
        helpmenu.message(HELPMESSAGE[language])
        helpmenu.alignment(viz.TEXT_LEFT_TOP)

There is no problem changing what the message is, it's just that the alignment shifts from the left to the right, and I'd really like to keep it aligned to the left. I've tried it with and without the helpmenu.alignment call.

If anybody has any ideas, I'd appreciate it.

Thanks.

Aaron

farshizzo 06-19-2009 03:28 PM

This looks like a bug, it will be fixed in the next release.

As a workaround, you can set the main text of the info box blank and add an additional text message which should preserve left alignment. Here is some sample code:
Code:

import viz
import vizinfo
viz.go()

M1 = """Help:
Select a muscle to closer examine it
Use the arrow keys to move the selected muscle
Use the right mouse button to rotate the selected muscle
Use + to zoom in and - to zoom out on the selected muscle
Press h to turn help on/off
Press r to reset the model"""

M2 = """Ayuda:
Seleccione un m?culo m? cerca para examinarlo
Utilice las llaves de flecha para mover el m?culo seleccionado
Utilice el bot? de rat? derecho para girar el m?culo seleccionado
Uso + enfocar adentro y - enfocar hacia fuera en el m?culo seleccionado
Presione h para dar vuelta a ayuda con./desc.
Presione r para reajustar el modelo"""

helpmenu = vizinfo.add('')
helptxt = helpmenu.add(viz.TEXT3D,M1)

def setHelpText(txt):
        helptxt.message(txt)
        helpmenu.dirty()
vizact.onkeydown(' ',setHelpText,M2)

FYI, you can use triple quoted strings to construct multi-line messages. This way you don't need to manually insert newline characters.

hosier 06-22-2009 09:22 AM

Thanks.

Aaron


All times are GMT -7. The time now is 09:51 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC