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

Login:
Pass:
 
 

Original thread:
Post 2 made on Wednesday February 3, 2010 at 00:59
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,995
If you are writing a library, you can do things like:

CF.activity().onEntry= function(){
// inside this function, keyword 'this' is the activity.

this.x=234; // works same as declaring a var in activity script.

};

What this allows is for you to declare variables for an activity in the library and therefore hide things such that users cannot modify them or screw things up.

Same applies for onExit which is a cleanup function where you can remove things.

Also note that pages support this as well where you can do such things as installing FirmKey handlers, create/destroy dynamic widgets, etc...

CF.activity().page('MyWellKnownPage').onEntry = function()
{
// install Firm1 press handler when page is started.
GUI.widget('PS_FIRM1').onPress= function(){
System.print('Firm1 Pressed');
};
// create dynamic widgets if you wish. (this keyword references current page)
this.w = GUI.newPanel(); // hope my syntax is right.
}

CF.activity().page('MyWellKnownPage').onExit = function()
{
// remove Firm1 press handler when page is exited.
GUI.widget('PS_FIRM1').onPress= null;
GUI.deleteWidget(this.w); // this is likely incorrect but put here to illustrate point.
this.w = null;
}
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse