Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!
on textChanged
send mouseup to btn "Update" of stack "My list"
end textChanged
Any changes I apply to this field, for example typing text, can not be undone by selecting "Undo" from the Edit menu. "Undo" works fine for other fields. Can I have a field with an "on textChanged" handler and still use "Undo" for that field?
I have no problem with this. There must be something else you are doing. To test, I made the two objects you describe. In the button script, I simply said:
put fld 1 --the field with the "textChanged" handler
When I type into the field, the field text appears in msg. When I undo, the last typed text is removed from the field, and also from msg.
Craig Newman
Last edited by dunbarx on Thu Nov 01, 2012 4:07 am, edited 1 time in total.
Thanks for your reply! I don't know what to say, it does not work for me. Undo does not work when I have the code in my field. When I comment out the code in the field, Undo works. I have nothing else in the field script, nothing in the card script, and only a closeStack handler in the stack script. I'm using 5.5.3 on a Mac.
Yes, I do. So it does work with a new stack. But it beats me why it doesn't work with my original stack. I only have that script in the field and when I comment the script out, it works. I now suspect that there might be an issue with my script in the "Update" button which somehow prevents Undo from working? Hmmm, weird stuff. Anyway, thanks, this was helpful!
on mouseUp
put empty into field "ToDo"
repeat with x = 1 to the number of cds of stack "MainApplication"
put field "ProjectID" of cd x of stack "MainApplication" & " - " & field "ProjectName" of cd x of stack "MainApplication" & return after field "ToDo"
repeat with y = 1 to the number of buttons of cd x of stack "MainApplication"
put name of button y of cd x of stack "MainApplication" into myButtonName
put (the number of chars of myButtonName)-1 into myNumberofChars
if char myNumberofChars of myButtonName = "•" then
if the enabled of btn myButtonName of cd x of stack "MainApplication" and not the hilite of btn myButtonName of cd x of stack "MainApplication" then put myButtonName & return after field "ToDo"
end if
end repeat
put field "Other" of cd x of stack "MainApplication" & return after field "ToDo"
put return after field "ToDo"
end repeat
end mouseUp
I'm guessing that when you select "Undo" my application tries to undo actions performed by this script instead of trying to undo the input typed by the user. When I comment out this essential part of the script, Undo works as expected.
Now beating my brain to get Undo to work while still performing the actions from this script...
Comment it out, and all is well. You may just be undoing the return, which may not have any apparent effect. But I understand from the dictionary that script invoked actions are not undoable, only user actions.
Thanks Craig. I tried it out, but just commenting out that line does not solve the issue. I need to comment out every line where the put command puts something into the field before Undo start working the way I want.
You could try a little hack. Use the "type" command instead of "put". That simulates a user action.
On second thought though, it will make your script very slow. You could set the typingRate to something fast, maybe that would help, but it probably won't be perfect.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com