|
|
|
Philips Pronto Professional Forum - View Post
|
|
|
|
|
|
|
The following page was printed from RemoteCentral.com:
Help with setting panel images in...
| |
|
Topic: | Help with setting panel images in prontoscript This thread has 4 replies. Displaying all posts. |
|
Post 1 made on Friday January 4, 2008 at 12:33 |
Deaky Long Time Member |
Joined: Posts: | August 2007 53 |
|
|
Hi
I thought it was about time to redesign my pronto and get to grips with prontoscript. I have a multiroom setup with 2 rooms. On the room selection page there two buttons, one for the lounge and one for the bedroom, these buttons contain the following script
System.setGlobal("Room","1") CF.widget("JUMP","RESOURCES").executeActions()
and
System.setGlobal("Room","2") CF.widget("JUMP","RESOURCES").executeActions()
On the main Activity menu page, I have buttons for watch tv, dvd etc. On this page I would like to know what the room is currently set to. I have a panel which can change it's label according to what value is stored in "Room" but what I want it to do is to display a different image acording to the value of "Room". I have a hidden page called RESOURCES and on that page I have 2 panels each with the image I require. The panels are called LOUNGE and BEDROOM respectively and they are sized the same as the panel on the activity menu page.
Im guessing I need to be using setImage() but the developers guide doesn't cover it much. Can someone point me in the right direction
Thanks Rich
|
|
Post 2 made on Friday January 4, 2008 at 16:47 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
You are heading in the right direction but please allow me to "steer" you aside a bit.
PDF files are also indeed searchable. In the Version 1.0 developers guide from July, the 2nd hit for "setImage" indicates there's an example for copying an image at the bottom of page 21.
Heres another example on copying images.
var wTarget = CF.widget('TARGET','MAINPAGE', 'HOMEACTIVITY'); var wResource = CF.widget('LIVING_ROOM',RESOURCES','MY_RESOURCES');
// copy the first image (index 0). wTarget.setImage(wResource.getImage(0),0);
To maintain state, you will need to use System.setGlobal() and System.getGlobal().
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
Post 3 made on Friday January 4, 2008 at 18:21 |
Barry Gordon Founding Member |
Joined: Posts: | August 2001 2,157 |
|
|
To elaborate, panels have one image and buttons have two. Think of the images as held in an array refrenced by indicies 0 and 1, Perhaps someday Philips will allow this array to be expandable and to hold many images for animation
The getImage method of a widget takes as an argument the index into the image array of that widget and returns a structure suitable to be used by the setImage method
The setImage method takes two arguments, the first being exactly that returned by the getImage method and the secondf the index into the widgets array of images where the gotten image is to be placed.
As Lyndel nicely shows most of us just use the getImage method on the source of the image as the first argument of setImage.
I am not sure if you can store the result of a getImage method in a prontoscript variable, but it would be nice if you could... Lyndel? I guess one could just try it out.
|
|
Post 4 made on Saturday January 5, 2008 at 03:57 |
Lyndel McGee RC Moderator |
Joined: Posts: | August 2001 12,999 |
|
|
Should work just fine although I, too, usually use the inline method of set/get.
Images can indeed be stored as they are just Javascript representations of underlying objects.
|
Lyndel McGee Philips Pronto Addict/Beta Tester
|
|
OP | Post 5 made on Saturday January 5, 2008 at 04:38 |
Deaky Long Time Member |
Joined: Posts: | August 2007 53 |
|
|
Thank you Lyndel. Your example makes far more sense to me then the one in the developers guide that I had already tried. Working perfectly now
Thanks again Rich
|
|
|
Before you can reply to a message... |
You must first register for a Remote Central user account - it's fast and free! Or, if you already have an account, please login now. |
Please read the following: Unsolicited commercial advertisements are absolutely not permitted on this forum. Other private buy & sell messages should be posted to our Marketplace. For information on how to advertise your service or product click here. Remote Central reserves the right to remove or modify any post that is deemed inappropriate.
|
|
|
|