| Post 1 made on Tuesday January 13, 2009 at 05:55 | ...it's new! |
flattermann Junior Member |
| |
Hi guys!
It's me again, sorry for asking so many dumb questions... :-)
Is it possible to dynamically create new widgets in ProntoScript?
Something like
var p = new Panel(); p.label = "Test"; p.top = 0; p.left = 0; p.width = 100; p.height = 100; p.visible = true;
Or is it possible to duplicate an existing widget via ProntoScript?
I would like to dynamically create new widgets or have a hidden LIBRARY page, get/copy the widgets from there and display them on the current page.
Thanks in advance! Christian |
 http://www.flattermann.net | [ Reply | Quote & Reply |
| Post 2 made on Tuesday January 13, 2009 at 10:09 | ...it's new! |
pthornhill Junior Member |
| |
no you can't do it. best you can do is have everything on the page and make it visible/invisible as/when needed. this is fine for a few objects but becomes and real ball ache if you want lots of objects on 1 page.
also this means you have duplication of objects which isn't great |
| [ Reply | Quote & Reply |
| Post 3 made on Tuesday January 13, 2009 at 10:42 | ...it's new! |
GuerillaBuild Junior Member |
| |
although it is a similar method to pthornhill, you can also use setImage and getImage to dynamically load widget graphics. If I want to use a different pressed or released state image on a button widget, I can pull a different graphic from a different page or from a web or local PC location (with the help of some tcp sockets) .
ex: currentwidget.setImage(someotherwidget.getImage(0),1);
The above gets the released state graphic (0) from someotherwidget and assigns it to the pressed state of currentwidget (1).
There are a number of other things you can do to make a large number of widgets manageable: Use the group function in PEP2 to make object positioning easier. Place hidden objects off page (set the PEP2 editor to landscape and with the TSU9400 at least, you get extra editing space to work with. If you save and download the xcf with objects outside the screen bounds, they still transfer to the Pronto. The nice part is that you can use script to move the object into view as you have in your original example. Thus use 'top' and 'left' to shunt the image into place. If your code is fluid, it should look like a slide in effect. |
 You can hide almost anything until you have to put the drywall up! | [ Reply | Quote & Reply |
| Post 4 made on Tuesday January 13, 2009 at 13:24 | ...it's new! |
flattermann Junior Member |
| |
Thanks again!
I already use .setImage() and .getImage() pretty often. :-) But that did not solve the need to have all buttons pre-existing on the page. :-/
But I will take a look at the workaround with the off page-buttons, that may be a good start. So I can put all buttons on the page, but off the screen and dynamically show them by adjusting .top and .left... Sounds good... |
 http://www.flattermann.net | [ Reply | Quote & Reply |
| Post 5 made on Tuesday January 13, 2009 at 14:30 | ...it's new! |
Lyndel McGee Loyal Member |
| |
| Off-screen will only work if you have a TSU9400. For a 9600/9800, you can move the groups to the edge of screen but at least 1 pixel must be visible in the editor. |
 Lyndel McGee Philips Pronto Addict/Beta Tester View EscientPronto 1.0.2 Docs - http://www.mediafire.com/do...hp?yyfzfzzok5z | [ Reply | Quote & Reply |
| Post 6 made on Tuesday January 13, 2009 at 15:20 | ...it's new! |
Barry Gordon Founding Member |
| |
I have asked the Pronto team for a change to PEP2 that would provide an infinite canvas for editig graphics with the "Pronto screen" shown as a movable rectangle. The coordinates of widgets would always be relative to the upper left corner of the screen rectangle no matter where it was. They allow the coordinates of a widget to be any 16 bit value so why not make it easy to deal with complex screens. For my 9400 work I always use the 9600 editor with a rectangle indicating the safe area which is always at 0,0.
I have heard nothing from the Pronto team, but we did discuss it at Cedia.. |
| [ Reply | Quote & Reply |