View Full Version : view: onkeypress/changing selection
wcwilson
02-11-2003, 09:02 PM
I am trying to use the onkeypress event in a view to detect the down or up arrow in the contacts list (contacts sample app). What exactly is the syntax I have to use on this event? I assume I just supply the method to call, but it doesn't seem to fire. I also tried using it sending one argument (this) hoping that it might send the character being typed.
I have three questions:
1) What do I have to do to get the event to fire?
2) Once #1 works, how can I determine what key was typed?
3) In the contacts sample app, would the following line in a method change the selection to the next row or am I missing something?
datarows.selector.selectNext(1);
Thanks,
--Wayne
antun
02-11-2003, 11:53 PM
Hey Wayne
1) What do I have to do to get the event to fire?
There is actually no onkeypress event. I believe that may be a bug in the LZX Reference.
To get what you want, the best thing would be to use a <command>.
Alternatively there is also the LzKeys service: http://www.laszlosystems.com/developers/learn/documentation/lzxref/LzKeys.php#api which is more along the onkeypress design you were thinking of and you'd have to register a delegate for the onkeydown event.
3) In the contacts sample app, would the following line in a method change the selection to the next row or am I missing something?
datarows.selector.selectNext(1);
The problem is that the selection manager, <dataselectionmanager> does not have a selectNext() method. I might be able to get you a workaround for this.
Take care,
Antun
wcwilson
02-12-2003, 05:27 AM
onkeypress is shown as an attribute at:
http://www.laszlosystems.com/developers/learn/documentation/lzxref/LzView.php#tag
Where I got the selectNext(1) command was:
http://www.laszlosystems.com/developers/learn/documentation/lzxref/LzDatapointer.php#selectNext
This is on the pointer, not the selector. I guess I could use "select( o )" with the selector if I could figure out how to get the current object out of the datapointer after I call selectNext(1) on it.
--Wayne
antun
02-12-2003, 11:13 AM
Originally posted by wcwilson
onkeypress is shown as an attribute at:
http://www.laszlosystems.com/developers/learn/documentation/lzxref/LzView.php#tag
This is our mistake. The onkey* events should not be there.
As for the pointer, the pointer is actually a pointer into a dataset. It's kind of like a cursor that you can manipulate using a bunch of methods. There is no datapointer in the rows of people in the contacts app. The rows of people are replicated with this (red) line in contacts.lzx:-
<view width="immediateParent.width" height="20"
clickable="true" bgcolor="#FFFFFF"
name="result"
onmousedown="datarows.selector.select( this ) ;"
ondblclick="mainWindow.openSelection();">
<datapath xpath="localdata:/resultset/*" name="codp"
replication="lazy" />
FYI, it's quite similar to saying the following: (Except that you couldn't have lazy replication).
<view width="immediateParent.width" height="20"
clickable="true" bgcolor="#FFFFFF"
name="result"
onmousedown="datarows.selector.select( this ) ;"
ondblclick="mainWindow.openSelection();"
datapath="localdata:/resultset/">
That said, the blue view above gets replicated, and becomes an instance of LzReplicationManager (http://www.laszlosystems.com/developers/learn/documentation/lzxref/LzReplicationManager.php#api). To access these views you use the LzReplicationManager APIs - you don't talk to them directly.
Now, because the blue view's parent tag has a dataselectionmanager in it:-
<dataselectionmanager name="selector" toggle="false" />
It can be selected (as you can see from the blue view's onclick event). That's why you have to go through the dataselectionmanager. When you ask the dataselection manager which view is selected, it does return a datapointer to the datanode which is selected. But although you can do selectNext() on that datapointer, you can't then reference the replicated view from the datapointer.
This is a hole in our APIs, and we will fix this. I know this isn't a solution, but does it clarify what's going on?
Take care,
Antun
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.