Is the clickCharChunk my friend?

Graham Samuel livfoss at mac.com
Tue Sep 23 07:33:18 EDT 2008


I'm still trying to create a simple Undo mechanism for a succession of  
fields acting as cells in a grid-like structure, a bit like a  
spreadsheet. I am not using table fields. It is easy to implement Cut,  
Copy, Paste and Clear functions for these fields, to be operated by  
conventional menu items,and it's possible to store the previous  
contents of a field before a cut, paste or clear modifies it. However  
in my Undo, I not only want to restore the contents of the last  
modified field, but I also want to put the insertion point back where  
it was before the action took place. I thought that by storing the  
clickCharChunk in a global variable, I would be able to restore its  
position by something like

   do("click at the loc of" && gRememberedInsertionPoint)

The problem with this approach is that the clickCharChunk seems very  
often to be empty. In the docs, it says that the clickCharChunk is  
only empty if the last click wasn't on a field, but I do my  
remembering from within a 'selectionChanged' handler within the field  
itself, so I can guarantee that the last click was in a field. I also  
tried it with an 'openField' message, but that doesn't seem to set the  
clickCharChunk either.

Clearly I have misunderstood something. Can anyone suggest an approach  
that will work?

TIA

Graham

PS if anyone is wondering about my previous problems with the  
focusedObject in this same project, it turned out to be a problem with  
the debugger I'm using thru GLX2. No doubt it will be fixed soon.



More information about the use-livecode mailing list