Implementing Undo for changes to a field made by a script

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Mag
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 802
Joined: Fri Nov 16, 2012 10:51 pm

Implementing Undo for changes to a field made by a script

Post by Mag » Wed Apr 17, 2013 1:30 am

The Dictionary reds:
The undo command cannot be used to undo actions performed by a script. Only user actions can be undone. For example, if you use a script to change the text in a field, the undo command cannot reverse that change, but if the user edits text, you can use undo to reverse the action.
So I assume that there is not way to use the standard undo menu command to a change made by a script in a field, right? :oops:
Last edited by Mag on Wed Apr 17, 2013 9:45 am, edited 2 times in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9578
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Usinf Undo for changes to a field made by a script

Post by dunbarx » Wed Apr 17, 2013 3:46 am

Hi.

This is correct.

The way I would get around it is to set a custom property with the most recent text, perhaps with a "textChanged" message or via a keyDown handler, and if you need to undo, you restore from that. Multiple undo's are possible that way, I suppose, but looks hairy.

Craig Newman

Post Reply

Return to “Mac OS”