Changing the clickLine

Richard Gaskin ambassador at fourthworld.com
Tue Feb 3 23:19:16 EST 2004


Gardner, Joseph A wrote:

> Richard said:
> 
>> What I'm trying to do is "navigate" a list field using the up/down arrow
>> keys.
> 
> If you turn on the traversalOn property for the field that behavior happens
> automatically.
>
> Yes, that's true, Richard, but it's quite different from the action of
> clicking a line in the field and performing an action on a file with the name
> of the text that you clicked on (the "value" of the clickLine). The field I
> have created has traversalOn set to "true" and lockText also set to "true".
> What I really need is to get the up/down arrow keys to change the clickLine
> and then simulate a mouse click at the clickLine location.
> 
> Man, this was so easy in Hypercard! :)

Why would the same methods you enjoyed in HyperCard not work in Rev?  You
can work just as hard if you need to. :)

As with HC, in Rev you can trap the arrowkey message and manually set the
hilitedLines, and also trap mouseDown, and then do something with the
selectedText.

Rev just provides a simpler alternative as an "also":  turn on the
traversalOn property, then respond to the selectionChanged message; the
arrowKey response is then automatic, and you get the same selectionChanged
message in response to clicks as well so the scripting should be just a tad
simpler than could be done in HC, where you'd have to handle both the
arrowKey and mouseDown messages separately.


People sometimes joke that Scott Raney (the inventor of the Rev engine)
holds a doctorate in cognitive psychology yet made a very ugly IDE (see the
old MetaCard IDE to see why that's funny).  But truth be told he put his
degree to good use, only his focus was on the engine and it's language
design.

A lot of things can be done differently in Rev than one might do the same
thing in HC or SC, but more often than not the Rev engine offers an
alternative which may take some "unlearning" to get used to but offers
bigger bang for the buck.  My favorite example is the "repeat for each"
contruct, but custom property sets are a close second for me.   The
selectionChanged and selectedObjectChanged messages are way up on that list
too.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list