Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Previous section Next section Previous page Next page Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Page 1 of 2
Topic:
how to change background
This thread has 22 replies. Displaying posts 1 through 15.
Post 1 made on Monday October 4, 2010 at 05:18
Franin
Long Time Member
Joined:
Posts:
April 2008
195
How is it possible to have different backgrounds for different pages in the same acitivity without having to create another different activities for different backgrounds?
Thanks

Frank
Post 2 made on Monday October 4, 2010 at 05:44
BluPhenix
Long Time Member
Joined:
Posts:
December 2008
371
Um make a panel the size of the screen, append an image and push it to the back?
OP | Post 3 made on Monday October 4, 2010 at 05:51
Franin
Long Time Member
Joined:
Posts:
April 2008
195
Sorry im a bit ignorant here but append an image what do you mean by that?
Thanks

Frank
Post 4 made on Monday October 4, 2010 at 06:11
2Many
Long Time Member
Joined:
Posts:
September 2009
106
I think BluPhenix means give the panel an image - of your choice.

If you use a panel that totally fills your screen you won't see anything from the system page and you won't see the graphics of your firm keys, even if you send it to the back. You'll have to size the panel to suit.
"Home" is where my Pronto is.
OP | Post 5 made on Monday October 4, 2010 at 06:17
Franin
Long Time Member
Joined:
Posts:
April 2008
195
How do you size the panel to suit? Sorry ive gone by redoing an activity everytime I wanted to do please wait and Im thinking it has to be an easier way than that.

Thank you all for helping btw
Thanks

Frank
OP | Post 6 made on Monday October 4, 2010 at 06:22
Franin
Long Time Member
Joined:
Posts:
April 2008
195
Thanks guys Ive just figured it.
Thanks

Frank
Post 7 made on Monday October 11, 2010 at 11:02
Vesa Mäkelä
Founding Member
Joined:
Posts:
December 2001
22
Can you change backgrounds with ProntoScript programming?
Post 8 made on Monday October 11, 2010 at 12:29
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
Yes, you can as long as the panel, and possibly page and activity containing the panel has a ProntoScript name set from the 'Advanced' tab. See Widget.setImage/getImage in the Dev Guide.

A forum search on setImage/getImage will likely show you some code snippets.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 9 made on Wednesday October 13, 2010 at 11:21
Vesa Mäkelä
Founding Member
Joined:
Posts:
December 2001
22
On October 11, 2010 at 12:29, Lyndel McGee said...
Yes, you can as long as the panel, and possibly page and activity containing the panel has a ProntoScript name set from the 'Advanced' tab. See Widget.setImage/getImage in the Dev Guide.

A forum search on setImage/getImage will likely show you some code snippets.

Thanks. I'll try that. My intention is to have different themes with different page backgrounds. For example with a Button in Home Page you could change the theme. So every page would be with different background according to the theme but activity buttons would be same in every theme.
Post 10 made on Wednesday October 13, 2010 at 14:44
Lowpro
Select Member
Joined:
Posts:
March 2004
2,081
Below is an example of how one might implement what you want to do where 4 different themes are available to choose from.

Step 1: Create an activity and give it the ProntoScript name, "Resources". This activity will be used to store your background images.

Step 2: Create a page under the activity and give it the ProntoScript name, "Images". Each of your background images will be placed on this page.

Step 3: Place 4 panels on the page inserting the appropriate background image to each, then giving each ProntoScript names. In this example they'll be named, "bkgd_1", "bkgd_2","bkgd_3", and "bkgd_4".

Now perform Steps 4-6 shown below for each of the activities in which you'd like custom backgrounds used per the selected theme.

Step 4: Place the below ProntoScript at the activity level.

function doPageStart() {
doSetBkgd();
}
//
function doSetBkgd() {
if(System.getGlobal ("Theme")=="1") {
widget("Background").setImage(CF.widget("bkgd_1","Images","Resources").getImage(0),0); return;
}
if(System.getGlobal ("Theme")=="2") {
widget("Background").setImage(CF.widget("bkgd_2","Images","Resources").getImage(0),0); return;
}
if(System.getGlobal ("Theme")=="3") {
widget("Background").setImage(CF.widget("bkgd_3","Images","Resources").getImage(0),0); return;
}
if(System.getGlobal ("Theme")=="4") {
widget("Background").setImage(CF.widget("bkgd_4","Images","Resources").getImage(0),0); return;
}
else { System.setGlobal ("Theme","1");
widget("Background").setImage(CF.widget("bkgd_1","Images","Resources").getImage(0),0);
}
}


The function doPageStart() will be executed at the page level which in turn is executing the function doSetBkgd(). The function doSetBkgd() is responsible for populating the appropriate background image based on the theme which was selected. If a theme wasn't selected "Theme 1" will be used by default.

Step 5: Place the below ProntoScript on each page within the activity.

doPageStart();

Step 6: Place a panel on each page within the activity to be used for your background image. Give the panel the ProntoScript name, "Background".

Step 7: Last thing needed is a place within your activity where you're able to select what theme to be used. In this example lets say this is being done from your Home page. So on the Home page create 4 buttons, one labeled for each theme, then add the below ProntoScript to each.

ProntoScript to be placed on the button labeled, "Theme 1":
System.setGlobal ("Theme","1");

ProntoScript to be placed on the button labeled, "Theme 2":
System.setGlobal ("Theme","2");

ProntoScript to be placed on the button labeled, "Theme 3":
System.setGlobal ("Theme","3");

ProntoScript to be placed on the button labeled, "Theme 4":
System.setGlobal ("Theme","4");

Now if you wanted your Home page to use a themed background image as well just make sure to implement Steps 4-6 shown above for the Home activity also. You'd also want to update the buttons on your Home page used to select each theme per the below as to ensure that when selecting a given theme the background image on the Home page updates on the fly.

ProntoScript to be placed on the button labeled, "Theme 1":
System.setGlobal ("Theme","1");
doPageStart();


ProntoScript to be placed on the button labeled, "Theme 2":
System.setGlobal ("Theme","2");
doPageStart();


ProntoScript to be placed on the button labeled, "Theme 3":
System.setGlobal ("Theme","3");
doPageStart();


ProntoScript to be placed on the button labeled, "Theme 4":
System.setGlobal ("Theme","4");
doPageStart();


Note above that the system global is first set, then the doStartPage() function is executed which in turn results in the background image on the home page being updated accordingly based on the selected theme.

Added note...
Per my example, note that I've defined the given functions at the activity level instead of on each page. This prevents one from having to update the given function if needed on each individual page for a given activity. Furthermore, the function doPageStart() is intended to run any needed ProntoScript when a given page is displayed. This is why I did not suggest executing the function doSetBkgd() on each page directly. The function doPageStart() is executed from each page instead. If at any point additional ProntoScript needs to be run when a given page is displayed you simply update the doPageStart() function at the activity level rather than having to update the ProntoScript on each page individually.

(An example XCF can be downloaded here.)

Last edited by Lowpro on November 21, 2011 17:12.
LP Related Links:
View my profile to access various
links to key posts and downloads.
Post 11 made on Wednesday October 13, 2010 at 18:34
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,999
Nice post LowPro.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 12 made on Wednesday October 13, 2010 at 18:45
Lowpro
Select Member
Joined:
Posts:
March 2004
2,081
On October 13, 2010 at 18:34, Lyndel McGee said...
Nice post LowPro.

Thanks! :-)
LP Related Links:
View my profile to access various
links to key posts and downloads.
Post 13 made on Thursday October 14, 2010 at 11:22
Vesa Mäkelä
Founding Member
Joined:
Posts:
December 2001
22
On October 13, 2010 at 18:34, Lyndel McGee said...
Nice post LowPro.

Thank You very much LowPro. I'll try that. This Forum is fantastic ...
Post 14 made on Friday October 15, 2010 at 09:19
Vesa Mäkelä
Founding Member
Joined:
Posts:
December 2001
22
Well, I got it working but only with 2 themes. If I try to use 4 themes theme numbers 2 and 3 gives theme 1 (that else part obviously). What gives.

Well now I have at least 2 theme choices.
Post 15 made on Friday October 15, 2010 at 09:25
Lowpro
Select Member
Joined:
Posts:
March 2004
2,081
My bad. I've updated the ProntoScript provided in Step 4 of my example per Post 10 of this thread. Will work for all 4 themes now.

I've created a small XCF file as well for anyone that would like to check out my example first hand. You can download said XCF here which was saved using the latest version of PEP v2. In my example XCF I have 5 themed backgrounds you can choose from on the Home page, themes 1-4 and the default theme. I've also included a text label which tells you what theme is currently selected. From the Home page you are then able to jump to another activity where you'll see that the appropriate background image is being used, then from there jump back to the Home page.

Last edited by Lowpro on November 21, 2011 17:16.
LP Related Links:
View my profile to access various
links to key posts and downloads.
Page 1 of 2


Jump to


Protected Feature 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.

Hosting Services by ipHouse