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

Login:
Pass:
 
 

Topic:
Swipe ,Flick ,Drag Background Help
This thread has 4 replies. Displaying all posts.
Post 1 made on Tuesday July 6, 2010 at 12:03
alpha
Long Time Member
Joined:
Posts:
September 2003
258
I just updated to Pronto Edit 2.4 and was experimenting with Gestures on my 9400. BluPhenix's Swipes made a great example. I created an activity where if you touch the background and Flick it , Swipe it or Drag it , all the buttons move in unison. One possible uses is to take a photo of the original equipment remote and use as the drag-image with button overlays. I made the background  ( 240 X 960 ), three times the height of the normal display. It is like having three pages in one. The movement is confined to the Y-Axis (up-down). If I Flick Down everything goes down until I stop it with a screen press or if the background reaches the limit. The same with Up.

It all works but...

If I Flick Down when it is already at the bottom the buttons will slide off the screen. Not Good. Same with up.
Also after a couple of hard flicks the buttons do not always stop in the same position relative to dragged background. All a little high or low.
I was looking for a way to keep the buttons on the screen in the same layout as when I put them in the editor , without having to define limits to them individually.
Any thoughts would be appreciated.



// Special speed flick- drag Background button
//When dragging or flicking the main background
// called "drag_back" the rest of the buttons follow.
//When reaching the top or bottom of the
// drag_back the movement stops.
//This only goes Up - Down.


var drag_back   = widget("DRAG_BACK") ;
// The Drag_BACK Button is 240 X 960 Semi-transparent or picture
// placed as the bottom layer.

var but_b = widget ( "BUT_B" ) ;  // Buttons that move with drag_back
var but_c = widget ( "BUT_C" ) ; // probably be about20 buttons in all.
var but_d = widget ( "BUT_D" ) ;
var but_e = widget ( "BUT_E" ) ;
var but_f = widget  ( "BUT_F" ) ;
var but_g = widget ( "BUT_G" ) ;

var old_Y ;     // initial position of top of Drag button
var change_in_Y = 0 ;  // change in position

//-----------------------------------------------------------------------

drag_back.onPress = function ( x,y ) {
    old_Y = y;
    change_in_Y = 0 ;
};

drag_back.onMove = function ( x,y ) {
    change_in_Y = old_Y - y ;
};

function moveAll ( ) {
// this function updates the position of the all buttons

    drag_back.top = drag_back.top - change_in_Y;  // the one pressed

    but_b.top = but_b.top - change_in_Y;  // Buttons that move with drag_back
    but_c.top = but_c.top - change_in_Y; // probably be about 20 buttons in all.
    but_d.top = but_d.top - change_in_Y;
    but_e.top = but_e.top - change_in_Y;
    but_f.top   = but_f.top - change_in_Y;
    but_g.top = but_g.top - change_in_Y;

    // change_in_Y = 0 ;  // speed flick is on
    // remove " //  "  to stop movement on release of Drag  Button

    if ( drag_back.top >= 0) {  // stop  movement at top
    drag_back.top = 0;
    change_in_Y = 0 ;
    };

    if (drag_back.top <= -640) {  // stop  movement at bottom
    drag_back.top = -640 ;
    change_in_Y = 0 ;
     };
    scheduleAfter ( 50,  moveAll ) ;   
};
moveAll ( ) ;



//Thanks.

Project Boredom 2 is here. [Link: mediafire.com]
------------------------
Check Version 1 & 2 out in the files section.
Post 2 made on Tuesday July 6, 2010 at 23:32
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
Just wondering. Did you download the philips module available from their site that demos the new features, including Gestures? They do an averaging algorithm and I'm not sure if that would help make things a bit less jerky.

With regard to up/down and allowing the moves, I'd simply set flags in your last 2 if clauses that allows movement in particular direction ONLY if flag for that direction is not set.

Where does the above code get installed? Page script or button script? I presume the former but would like to confirm?

Also, I am curious as to why are you you using scheduleAfter? From the code above, it appears that moveAll() is called repeatedly and the scheduleAfter() chain is never broken. The fact that you care changing variables in onMove and then using scheduleAfter() for sure can cause jerky movement.

Also, why are you calling moveAll() on the initial button press/page activate? Is it to kick off the timer?
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 3 made on Wednesday July 7, 2010 at 00:48
alpha
Long Time Member
Joined:
Posts:
September 2003
258
I looked at the Philips Module. It did not work so well in my simulator. Seemed a little jerky in movement . The Mixer and Text worked well. BluPhenix made a Swipe Demo that was easier for me to understand. It was what I based most of the script on. I placed this script in the page section but I now think it should be in a button. The script is very fast and responsive the way it is (not at all jerky).

I tried to write something without the scheduleAfter but it did not work. I might try again since you mentioned it. It seemed to me with the scheduleAfter in the moveAll function ,I could Flick things across the screen. The faster I Flicked or Swiped, the faster things moved,but I did not realize that the moveAll was constantly running.

Thanks for pointing out everything Lyndel.
Much Appreciated.
Project Boredom 2 is here. [Link: mediafire.com]
------------------------
Check Version 1 & 2 out in the files section.
Post 4 made on Wednesday July 7, 2010 at 10:52
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,994
Do a System.print() and you will see it is constantly running. That's why things are so 'zippy' as you point out.

With regard to testing things in the simulator, please keep in mind that when testing on simulator, you are using the power of the Main CPU and Graphics CPU. When testing on the Pronto, you are using the "Real Thing".


I have started to use PEPV2 simulator for some things but find that my older way of working with the Docking Station Mod (See www.the-gordons.net for Pronto Debugging) still works best for me as my configurations still are based in PEPV1 but capable of being loaded into PEPV2 (I've already done the pre-work for My Database).
Lyndel McGee
Philips Pronto Addict/Beta Tester
OP | Post 5 made on Thursday July 8, 2010 at 03:53
alpha
Long Time Member
Joined:
Posts:
September 2003
258
The system.print is a good check for an endless loop like I had . I'll definitely use that more often to check things. I eliminated the scheduleAfter and came up with this script for the button. It still lacks the pep of the other script. Nothing will flick across the screen. You pretty much have to drag it.


//    Place in button DRAG BACK size 240 x 960 centered on screen

var drag_back = widget ( "DRAG_BACK" )  ; //button with solid or Semi-transparent background
var but_b = widget ( "BUT_B" ) ;        // Buttons or Panels that move with drag_back
var but_c = widget ( "BUT_C" ) ;      // probably be about 20 in all.
var but_d = widget ( "BUT_D" ) ;
var but_e = widget ( "BUT_E" ) ;
var but_f = widget  ( "BUT_F" ) ;
var but_g = widget ( "BUT_G" ) ;

var old_Y ;                 // initial position of top of Drag button
var change_in_Y = 0 ;      // change in position
var happy = 1 ;           // Couldn't think of a description
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function butAll ( ) { // the applied change
    drag_back.top = drag_back.top - change_in_Y ;  // the one pressed
    but_b.top = but_b.top - change_in_Y;          // Buttons that move with drag_back
    but_c.top = but_c.top - change_in_Y;         // probably be about 20 buttons in all.
    but_d.top = but_d.top - change_in_Y;
    but_e.top = but_e.top - change_in_Y;
    but_f.top   = but_f.top - change_in_Y;
    but_g.top = but_g.top - change_in_Y;
 } ;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function moveUp ( ) {
    butAll ( ) ;
    if ( drag_back.top >= 0) {   // stop movement at top
    drag_back.top = 0;
    happy = 2 ;
     } ; } ;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
function moveDown ( ) {
    butAll ( ) ;
    if (drag_back.top <= -640) {   // stop movement at bottom
    drag_back.top = -640 ;
    happy = 3 ;
     } ; } ;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drag_back.onPress = function ( x,y ) {  //when you press the button
    old_Y = y ; } ;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
drag_back.onMove = function ( x,y ) {  //when you move the button
    change_in_Y = old_Y  - y ;
    if ( (change_in_Y < 0 )  &&  ( happy !== 2 ) ) { // moves in up direction
    moveUp ( ) ;
    };
    if ( ( change_in_Y > 0 )  &&  (  happy !== 3 ) ) {
// moves in down direction
    moveDown ( ) ;
    };  } ;
// x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x x END

I have found one Major drawback to Gestures in general. I am constantly cleaning my screen.   :(


Project Boredom 2 is here. [Link: mediafire.com]
------------------------
Check Version 1 & 2 out in the files section.


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