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 2 of 3
Topic:
UI Concepts - Popup Design Patterns - A community effort to achieve unified functionality
This thread has 35 replies. Displaying posts 16 through 30.
Post 16 made on Monday April 12, 2010 at 22:06
alpha
Long Time Member
Joined:
Posts:
September 2003
258
I thought you were also looking for design ideas for the U.I. .

When it comes to moving a group of buttons and panels ( a "Window"), I have no idea how to script it . I'm still using Prontoedit 2.3 . But if the Task-Bar ( the top part of the Window ) was a button, I figured out 2 ways to make the Window (240 pixels wide ) close when moving off screen.

1. If this was a 9400 remote, on release of the Task-Bar-Button it would check the "left" position and if it were greater then 235 or less then -235 it would make the Window not visible.

2. If the Task-Bar-Button was held down for 2 seconds it would close using the onHold function.

Maybe someone else could help with actual movement of the elements involved with the Window.
It could be discussed in another post.
Project Boredom 2 is here. [Link: mediafire.com]
------------------------
Check Version 1 & 2 out in the files section.
OP | Post 17 made on Tuesday April 13, 2010 at 01:17
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
Design ideas are indeed welcome. I was primarily interested in functionality/design of the XML descriptor (Item #4) and things that folks might consider that they wanted.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 18 made on Tuesday April 13, 2010 at 05:14
Sogliphy
Long Time Member
Joined:
Posts:
July 2007
186
On April 12, 2010 at 22:06, alpha said...
[...]
1. If this was a 9400 remote, on release of the Task-Bar-Button it would check the "left" position and if it were greater then 235 or less then -235 it would make the Window not visible.

[...]

When making functionality depending on the display size, please use the GUI.width and GUI.height properties, instead of relying on the model name.

That way, the same code will work for TSU9600 and TSU9800.

If the code is relying on System.getModel(), the code has to be updated should there ever be another Pronto model using the same resolution.
Post 19 made on Tuesday April 13, 2010 at 05:22
Sogliphy
Long Time Member
Joined:
Posts:
July 2007
186
On April 13, 2010 at 01:17, Lyndel McGee said...
Design ideas are indeed welcome. I was primarily interested in functionality/design of the XML descriptor (Item #4) and things that folks might consider that they wanted.

Why not use JSON for this, instead of XML ?

Processing JSON, using eval(), is much faster than processing XML. (I know, eval(..) is typically a bad idea, but in this case I think the risk for malicious code is minimal)
Post 20 made on Tuesday April 13, 2010 at 06:41
Sogliphy
Long Time Member
Joined:
Posts:
July 2007
186
On April 12, 2010 at 12:41, Barry Gordon said...
[...]
Here is some snippett code

var MSG=new Array(); MSG[0]={}; // This is for the general user message
MSG[0].label="OK"; // There is one button in the descriptor array at index 0
MSG[0].action="Popup,Remove,userMsg"; // What to do when pressed
MSG[0].color=255 // color for button text

var UMpnl=""; // This is the panel object storage
var UMbtn=new Array(); // This is the button array storage for a popup object.

var userMsg={}; // this is the definition of a Popup to do user messages
userMsg.name="UserMsg"; // The name of this popup
userMsg.Rpage="Resources"; // Where the widget images are (a resource page)
userMsg.Rpanel="UMPanel"; // widget for backgropund of the popup
userMsg.Rbutton="UMButton"; // widget for the buttons (all look the same)
userMsg.Dpanel=UMpnl; // temporary storage for panel
userMsg.Dbutton=UMbtn; / temporary storage for buttons
userMsg.btnInfo=MSG; // the name of the button descriptor array
userMsg.buttons=[0]; // which buttons in the button descriptor array to use

doPopup("Show",userMsg,"A non recoverable Socket\nTimeout has Occurred.")

Barry,

Be aware that if you initialize objects like this in JavaScript, the object is de-referenced every time you set a property. Instead, do something like:

var MSG, UMpnl, UMbtn, userMsg;
MSG = [
  {
    label: "OK",
    action: "Popup,Remove,userMsg",
    color: 255
  }
];
UMpnl = "";
UMbtn = [];
userMsg = {
  name : "UserMsg",
  Rpage: "Resources",
  Rpanel: "UMPanel",
  Rbutton: "UMButton",
  Dpanel: UMpnl,
  Dbutton: UMbtn,
  btnInfo: MSG,
  buttons: [0]
};


When compiled to SpiderMonkey byte code, you'll end up with:

[..]
00069: name "Object"
00072: pushobj
00073: newinit
00074: string "UserMsg"
00077: initprop "name"
00080: string "Resources"
00083: initprop "Rpage"
[..]

instead of

[..]
00077: name "Object"
00080: pushobj
00081: newinit
00082: endinit
00083: setvar 3
00086: pop
00087: getvar 3
00090: string "UserMsg"
00093: setprop "name"
00096: pop
00097: getvar 3
00100: string "Resources"
00103: setprop "Rpage"
00106: pop
[..]
OP | Post 21 made on Tuesday April 13, 2010 at 11:46
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
On April 13, 2010 at 05:22, Sogliphy said...
Why not use JSON for this, instead of XML ?

Processing JSON, using eval(), is much faster than processing XML. (I know, eval(..) is typically a bad idea, but in this case I think the risk for malicious code is minimal)

I was considering a lightweight set of code. Had not considered JSON as I consider it heavyweight. Would I not need a library of JSON code to process the stuff which would indeed also add additional overhead for performance?
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 22 made on Tuesday April 13, 2010 at 12:04
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
On April 13, 2010 at 11:46, Lyndel McGee said...
I was considering a lightweight set of code. Had not considered JSON as I consider it heavyweight. Would I not need a library of JSON code to process the stuff which would indeed also add additional overhead for performance?

I'm rewriting two jason parsers to modules, but you can use eval, and it's very quick. We just need to make sure that the JSON string is really solid. Then using eval is no problem. We might even be able to build contructor functions so they can be build on page load.

I'm actually considering to drop the JSON parsers and start using eval aswell.
OP | Post 23 made on Tuesday April 13, 2010 at 14:49
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
I've used eval since day #1. Eval is not the issue I was concerned with. It is the overhead of having to load a JSON library for everything. ;-)

If you have one you are considering/working with, I'd like to give it a try. You can email me @ yahoo as I can pickup attachments there.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Post 24 made on Tuesday April 13, 2010 at 17:56
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
On April 13, 2010 at 14:49, Lyndel McGee said...
I've used eval since day #1. Eval is not the issue I was concerned with. It is the overhead of having to load a JSON library for everything. ;-)

If you have one you are considering/working with, I'd like to give it a try. You can email me @ yahoo as I can pickup attachments there.

There is no need to email it, it's just a compressed version of json2.js form json.org. (The one that's working, my own parser still is kind of a mess.)

if(!this.JSON){this.JSON={};}(
function(){function f(n){return n<10?'0'+n:n;}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}if(typeof rep==='function'){value=rep.call(holder,key,value);}switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null'
Post 25 made on Tuesday April 13, 2010 at 18:01
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
Pasting doesn't work, I'll mail it.

It's send as plain text (so no html no attachment) hopefully it's not blocked.
Post 26 made on Tuesday April 13, 2010 at 18:25
gopronto
Senior Member
Joined:
Posts:
April 2008
1,453
My thoughts on POP ups or panels that slide in and out of view.

I have had request for scripts like this and it is usually to do with, cable TV , Sky or TiVo because of the amount of channels.

So ..

to have a script where you could add as many TV channel logos to page's ( which would have the IR codes attached for each channel e.g001)

Activity Sky TV
so Page 1 ( not hidden) would have the control buttons on this page e.g. play/pause, stop rev etc.
and also a category button, when pressed would POP up / slide over ( hidden page 2) e.g "Sport" "Film" "Documentaries" Buttons etc

when the category was chosen, this page would Pop Down /slide out page 2 and POPup/slide over the Channel icons ( hidden page 3, 4,5 ,6 etc.)

Settings page for the script,
Page timer= amount of time for POPupsliding pages



For the script you would had to give each button a unique tag, which would be fine.
Pronto still one of the best Wi-Fi Remotes,
www.ikonavs.co.nz and [Link: axiumcontrol.com] Axium Control
Post 27 made on Wednesday April 14, 2010 at 05:10
Sogliphy
Long Time Member
Joined:
Posts:
July 2007
186
On April 13, 2010 at 14:49, Lyndel McGee said...
I've used eval since day #1. Eval is not the issue I was concerned with. It is the overhead of having to load a JSON library for everything. ;-)

If you have one you are considering/working with, I'd like to give it a try. You can email me @ yahoo as I can pickup attachments there.

But if you are using eval(..), you don't need a JSON library.

JSON is (a subset of) JavaScript, so it can be eval'ed directly.

For example:

var jsonText, jsonObj;
jsonText = '[ { "name": "Bob" }, { "name": "Alice" } ]';
jsonObj = eval(jsonText);
System.print(jsonObj[0].name); // Prints "Bob"

In JavaScript for web browsers, parsing JSON this way is typically frowned upon, because eval(..) will execute ANY JavaScript code, not just JSON. So this creates a security risk if the text you are trying to parse might contain malicious code (AKA "code injection attack").

However, in this context (parsing a generated piece of JSON to define UI elements), the JSON source text will probably not contain malicious code, and using eval isn't such a risk.

On http://www.json.org/, you can find 4 different JSON parsers implemented in JavaScript. These do not use eval(), and should be used when processing JSON source which is untrusted. (In Webbrowser-based javascript programming, this means *always*)

Last edited by Sogliphy on April 14, 2010 05:44.
Post 28 made on Wednesday April 14, 2010 at 10:02
sWORDs
Long Time Member
Joined:
Posts:
November 2006
373
Those parsers without eval are really slow.
Post 29 made on Wednesday April 14, 2010 at 19:34
Lowpro
Select Member
Joined:
Posts:
March 2004
2,081
From a laypersons perspective when it comes to ProntoScript I would really like support added for groups. Currently a group has no properties. If a group did have properties as do panels, buttons, pages, and devices you could give said group a ProntoScript name, then addressing the group rather than having to address each panel/button of the group individually.

Last edited by Lowpro on April 14, 2010 19:47.
LP Related Links:
View my profile to access various
links to key posts and downloads.
OP | Post 30 made on Wednesday April 14, 2010 at 21:20
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,996
LP,

That is the WidgetSet I speak of but only with respect to movement/visibility.
Lyndel McGee
Philips Pronto Addict/Beta Tester
Page 2 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