The previous selection

Bob Sneidar bobs at twft.com
Tue Jan 3 12:10:32 EST 2012


Yes that is what I do. In a selectionChanged handler, the last thing I do is store the current selection in a property of the object. Any validation failure before that I set the selection to that property and bail out before it saves the property. Of course I have to lock messages before setting the selection back again or risk endless loop. 

Bob


On Dec 30, 2011, at 9:15 PM, DunbarX at aol.com wrote:

> 
> 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
> 
> 
> _______________________________________________
> 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