WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Vizinfopanel automatic resize problem (https://forum.worldviz.com/showthread.php?t=5692)

Erikvdb 04-13-2016 03:00 AM

Vizinfopanel automatic resize problem
 
Hi, I've ran into an issue with an infopanel in one of my projects. The default behavior of the infopanel is that it automatically resizes to the text or objects inside, which is fine for my application. However when I want to change one of the texts during the task, the panel doesn't automatically resize.

I've isolated the problem to this. The following code works, and the infobox is wrapped nicely around the new line.
Code:

import viz, vizinfo

viz.go()

ip = vizinfo.InfoPanel('', icon=False, align=viz.ALIGN_CENTER)
text = ip.addItem(viz.addText('hi'), fontSize=18, align=viz.ALIGN_CENTER_CENTER)

def setMessage():
        text.message('this is a looooooooong line')
       
setMessage()

But the following code, when pressing spacebar, the text changes but the infobox keeps it's original width, so the new text overflows.

Code:

import viz, vizinfo, vizact

viz.go()

ip = vizinfo.InfoPanel('', icon=False, align=viz.ALIGN_CENTER)
text = ip.addItem(viz.addText('hi'), fontSize=18, align=viz.ALIGN_CENTER_CENTER)

def setMessage():
        text.message('this is a looooooooong line')

vizact.onkeydown(' ', setMessage)

I have a workaround where I just pad the original line with spaces to the length of the new line, so the infobox is always the same size (or I could do something like this), but maybe there's a different solution or maybe this is a bug that needs fixing :)

Jeff 04-13-2016 11:36 AM

Thanks for the examples and good to know you already found workarounds. I will pass this along to the developers in case this is a bug.

Jeff 04-14-2016 03:00 AM

The following code adds a line to mark the panel as dirty and recompute the layout. Does this work the way you would expect?

Code:

import viz, vizinfo, vizact

viz.go()

ip = vizinfo.InfoPanel('', icon=False, align=viz.ALIGN_CENTER)
text = ip.addItem(viz.addText('hi'), fontSize=18, align=viz.ALIGN_CENTER_CENTER)
panel = ip.getPanel()

def setMessage():
        text.message('this is a looooooooong line')
        panel.dirtyLayout()

vizact.onkeydown(' ', setMessage)


Erikvdb 04-14-2016 05:11 PM

That works great, thanks!

JasmineJasmine 04-26-2016 02:14 PM

I can resize the window but the screen resolution keeps stucks at a max of 1280x1024. The resolution of the host is 1600x900 or 1920x1200 (=external monitor).I'll try your suggestions and give feedback..

Jeff 04-27-2016 02:31 AM

Quote:

I can resize the window but the screen resolution keeps stucks at a max of 1280x1024. The resolution of the host is 1600x900 or 1920x1200 (=external monitor).I'll try your suggestions and give feedback..
Sorry, I'm not quite following here. Are you referring to an issue within Windows or is this Vizard specific?


All times are GMT -7. The time now is 06:27 PM.

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