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 3
Topic:
[SOLVED]Change multiple key actions on press of a key
This thread has 36 replies. Displaying posts 1 through 15.
Post 1 made on Wednesday December 28, 2011 at 09:35
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
Hi,

I'm new to ProntoEdit and I am using version 3 to program my Pronto TSU9800.

1) I have setup an overlay as an onscreen keyboard. Is it possible to setup one of the soft keys on my overlay i.e. when clicked to toggle all the keys to different actions like i.e. from text keys to number keys?

2) Also is it possible to change the overlay so it doesn't slide in from the sides but up from the bottom?

Many thanks

Steve

Last edited by Stealth on January 22, 2012 11:02.
Post 2 made on Wednesday December 28, 2011 at 12:15
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,148
1) Most elegant solution requires script to do this. Less elegant solution involves duplication of the keyboard on 2 or more pages, change titles/actions from keys and have your toggle key do page jumps between the 2 or more pages.

2) I can't recall what the overlay options are for slide in. If it is not readily available in the drop down, then the answer is likely no.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Wednesday December 28, 2011 at 12:20
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
On December 28, 2011 at 12:15, Lyndel McGee said...
1) Most elegant solution requires script to do this. Less elegant solution involves duplication of the keyboard on 2 or more pages, change titles/actions from keys and have your toggle key do page jumps between the 2 or more pages.

2) I can't recall what the overlay options are for slide in. If it is not readily available in the drop down, then the answer is likely no.

Thanks for your reply.

1) I'm new to Prontoscript, anyone have any idea how to write this script or can point me to where I could find out how to do this?

2) No the only option is slide in. Oh well!

Thanks again

Steve
Post 4 made on Wednesday December 28, 2011 at 14:23
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,148
You can download the ProntoScript Dev Guide from the files section here.

If you don't know Javascript, you might want to pick up the Flanagan book referenced as the "bible" in the appendix of the Dev Guide. You will only need to review the first 10 or so chapters to get Core Javascript programming down.

To get an idea of the basics of changing labels on buttons/panels, etc... Have a look at this configuration (built for 9400)

[Link: files.remotecentral.com]

Lyndel
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Thursday December 29, 2011 at 03:41
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
On December 28, 2011 at 14:23, Lyndel McGee said...
You can download the ProntoScript Dev Guide from the files section here.

If you don't know Javascript, you might want to pick up the Flanagan book referenced as the "bible" in the appendix of the Dev Guide. You will only need to review the first 10 or so chapters to get Core Javascript programming down.

To get an idea of the basics of changing labels on buttons/panels, etc... Have a look at this configuration (built for 9400)

[Link: files.remotecentral.com]

Lyndel

Thanks for the link. I have ordered the Javascript book and I am having a play with Prontoedit 3 before it arrives.

Steve
OP | Post 6 made on Thursday December 29, 2011 at 07:26
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
Help!

I have put the following code to a Button on an Overlay to make another Button on the same Overlay invisible. However it doesn't work. If I paste the same code onto a Page instead of the Overlay it works ok. Should this also work on an Overlay?

onPress = function()

{CF.widget("ABC").visible = false}

Thanks

Steve
Post 7 made on Thursday December 29, 2011 at 09:23
gadgetman1
Long Time Member
Joined:
Posts:
January 2009
20
On December 29, 2011 at 07:26, Stealth said...
Help!

I have put the following code to a Button on an Overlay to make another Button on the same Overlay invisible. However it doesn't work. If I paste the same code onto a Page instead of the Overlay it works ok. Should this also work on an Overlay?

onPress = function()

{CF.widget("ABC","PS_OVERLAY").visible = false}
Thanks

Steve

Now is correct.
OP | Post 8 made on Thursday December 29, 2011 at 11:19
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
On December 29, 2011 at 09:23, gadgetman1 said...
{CF.widget("ABC","PS_OVERLAY").visible = false}

Now is correct.

Thanks thats great.

The last thing I'm struggling with is trying to change the actions for Button "K2"

on press of another button. All buttons are on the same Overlay. I tried:-

{CF.widget("K2","PS_OVERLAY").action = VMCCommand ("key:W");}

but this fires the action as soon as I press my "Shift" Button. I want to change the action so it fires

VMCCommand ("key:W");}

onPress of "K2"

Any help would be much appreciated.

Thanks again
Post 9 made on Friday December 30, 2011 at 17:53
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,148
You cannot change actions/actionlists for buttons via script.

If you need 2 different action lists to execute depending on state, I recommend that you create 2 buttons with same ProntoScript Name on 2 separate hidden pages and then use executeActions() or scheduleActions() against the correct widget/button.

In the onscreen button (the one you'd press for Key A on your keyboard), do something like the following.

if (keyboardState == 0) // unshifted
CF.widget("KeyA", "Unshifted").scheduleActions();
else if (keyboardState == 1) // shifted
CF.widget("KeyA", "Shifted").scheduleActions();


In the action of your shift key, you'd simply set the appropriate keyboard state. Note that keyboardState is a variable you declare in you activity or in the page script of the page where the GUI keyboard is contained.

Also note that the "Unshifted" and "Shifted" strings above are the ProntoScript names that you assign to the hidden pages where you have your keyboard buttons that contain the actions you want to execute for each state.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 10 made on Saturday December 31, 2011 at 08:44
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
On December 30, 2011 at 17:53, Lyndel McGee said...
You cannot change actions/actionlists for buttons via script.

If you need 2 different action lists to execute depending on state, I recommend that you create 2 buttons with same ProntoScript Name on 2 separate hidden pages and then use executeActions() or scheduleActions() against the correct widget/button.

In the onscreen button (the one you'd press for Key A on your keyboard), do something like the following.

if (keyboardState == 0) // unshifted
CF.widget("KeyA", "Unshifted").scheduleActions();
else if (keyboardState == 1) // shifted
CF.widget("KeyA", "Shifted").scheduleActions();

In the action of your shift key, you'd simply set the appropriate keyboard state. Note that keyboardState is a variable you declare in you activity or in the page script of the page where the GUI keyboard is contained.

Also note that the "Unshifted" and "Shifted" strings above are the ProntoScript names that you assign to the hidden pages where you have your keyboard buttons that contain the actions you want to execute for each state.

Hi Lyndel,

Again, thank you for your help and patients itís much appreciated.....

I still havenít received my "The Definitive Guide" book yet, so I'm still not 100% on the code. However I think I have the gist of what you are saying.

Forgive me if I am wrong, but will this work with the Overlay I'm using? I can see it working on a page ok but I would prefer to use an Overlay as I like the Overlay experience.

Your idea of duplicating the keyboard sounds good. Would it be possible to do this and stack one key on top of the other on the same Overlay and when the Overlay is called to enter, set some code to hide one/two of the set of keys i.e.

LC could be for Lowercase key
UC could be for Uppercase key
NM could be for Number key

If I have completely misunderstood let me know and I will have to wait until my book arrives.

Cheers

Steve


Post 11 made on Saturday December 31, 2011 at 14:29
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,148
Will work just fine in an overlay. Simply put your UI buttons there and then use scheduleActions/executeActions to execute the actionlist of buttons on hidden pages.
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 12 made on Sunday January 1, 2012 at 13:54
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
I'm struggling with this. I have been at it on and off all day and still can't quite get it to work. Can someone give me a pointer to where I am going wrong please?

Where I am so far:-

a) I have declared two variables on the Action Properties Advanced page like so:-

// 0 = Unshifted (low). 1 = Shifted (Caps)
var keyboardState = 0;

// Check keys output. 5 = No change
var OutputState = 5;

b) On my existing keyboard overlay I have put Lyndel's code on the actions tab for one of the keys labeled "A" and called KeyA as the prontoscript name. 

// 0 = Unshifted (low) 1 = Shifted (Caps)
if (keyboardState == 0) // Unshifted
CF.widget("KeyA", "Unshifted").scheduleActions);
else if (keyboardState == 1) // Shifted
CF.widget("KeyA", "Shifted").scheduleActions();

c) I created two new pages called Shifted and UnShifted, Then pasted all the buttons which I copied from my existing keyboard overlay to each of the new pages. On the Shift key actions tab for Shifted I put the following code:-
keyboardState = 1;
And for the Unshifted shift key:-
keyboardState = 0;
d) On the first key for both pages and the overlay I have named them all as KeyA for the Prontoscript Name.
e) I have set the actions for KeyA on the Shifted page as:-
OutputState = 6;
And for Unshifted:-
OutputState = 10
I did this so to confirm the key actions are changing when the shift key has been operated. When KeyA on the overlay is pressed I am reading the variable Output state into a label so see the output.
f) When I run my test I call the overlay from a hard button and press KeyA, but nothing happens (variables are unchanged) I then press the shift key and the keyboard variable changes to 1 as expected. I then press KeyA again and nothing changes..
For the life of me I don’t know what I’m doing wrong. I’m sure its something stupid, please be gentle!
Thanks you for taking the time to read this long post.
Steve
Post 13 made on Sunday January 1, 2012 at 15:16
Guy Palmer
Active Member
Joined:
Posts:
June 2008
648
Steve,

Yes, it is a long post so I might have misunderstood some part of it.

Although prontoscript can be added to a button via the actions tab (by pressing the prontoscript button), such scripts are completely separate from the actionlists that are the main thing in the actions tab.  As a consequence, when you do a scheduleActions, it invokes the button's actionlist but it does not invoke its prontoscript.  Hence your test scripts of OutputState=6 etc are never executed but if you replaced these with actionlists then they would be.
OP | Post 14 made on Sunday January 1, 2012 at 15:59
Stealth
Long Time Member
Joined:
Posts:
December 2003
59
On January 1, 2012 at 15:16, Guy Palmer said...
Steve,

Yes, it is a long post so I might have misunderstood some part of it.

Although prontoscript can be added to a button via the actions tab (by pressing the prontoscript button), such scripts are completely separate from the actionlists that are the main thing in the actions tab.† As a consequence, when you do a scheduleActions, it invokes the button's actionlist but it does not invoke its prontoscript.† Hence your test scripts of OutputState=6 etc are never executed but if you replaced these with actionlists then they would be.

Guy,

Thank you for your reply. Again apologises for the previous long post. I thought it best to post the full detail.

I know I sound thick but can you advise on the correct syntax I will need to use?

Itís been a long day and I'm way out of my depth with this. I know I need to do some serious reading on Javascript otherwise I will be wasting more days going around in circles.

Thank you to those who have kindly helped, itís much appreciated.

Steve
Post 15 made on Monday January 2, 2012 at 01:17
Guy Palmer
Active Member
Joined:
Posts:
June 2008
648
On January 1, 2012 at 15:59, Stealth said...
Apologies for the previous long post. I thought it best to post the full detail.

No need at all to apologise - detail is good!  But I appreciate your politeness!

I know I sound thick but can you advise on the correct syntax I will need to use?

Your syntax looks fine to me, apart from the missing opening bracket near the end in CF.widget("KeyA", "Unshifted").scheduleActions).  In any event, if you make a syntax error, it will tell you in both the console (if using the simulator) and the debug widget (if using the actual pronto)

It’s been a long day and I'm way out of my depth with this. I know I need to do some serious reading on Javascript otherwise I will be wasting more days going around in circles.

Reading about Javascript won't help you re either CF.widget or scheduleActions() as these are prontoscript extensions rather than core Javascript.  The prontoscript developers guide is the only document for reading about these matters.
Page 1 of 3


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