The previous selection

dunbarx at aol.com dunbarx at aol.com
Sat Dec 31 00:15:33 EST 2011


Bob.


I played around with this for just a minute. The main issue is that the selectionChanged message is sent after the selection has changed, so that it is easy to get the new selectedText, but not the old. Perhaps the best route is to keep track of the most recent and next-most recent selections in a custom property of the field:


on selectionChanged var
   set the recentText of me to item 2 of the recentText of me & "," & the selectedtext
   put the recentText  of me into fld "mostRecent" --just for testing
end selectionChanged


I made a field "mostRecent" just to see the data. Select successive  various text in the target field. You can now call either item of the custom property as needed.


As you say, too bad the message doesn't natively know where it was as well as where it ends up.


Craig Newman



-----Original Message-----
From: Bob Sneidar <bobs at twft.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Fri, Dec 30, 2011 9:30 am
Subject: The previous selection


I vaguely remember a discussion a long time ago about getting the last thing 
selected, when you selected something different. In my case, I want to detect a 
selectionChanged, verify some things and then go back if the verification fails. 
I can code it, but I was hoping there would be something easier along the lies 
of:

on selectionChanged theOldSelection

Bob
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list