Is the clickCharChunk my friend?

Eric Chatonet eric.chatonet at sosmartsoftware.com
Tue Sep 23 07:44:26 EDT 2008


Bonjour Graham,

The clickCharChunk function returns a chunk expression of the form  
char charNumber to charNumber of field fieldNumber:
  it's not a point you can click at.
Anyway, probably you might prefer to store the selectedChunk instead  
and use do "select" && gRememberedInsertionPoint
This will not only position the insertion point but restore a  
possible selection.

Le 23 sept. 08 à 13:33, Graham Samuel a écrit :

> 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

Best regards from Paris,
Eric Chatonet.
----------------------------------------------------------------
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/
----------------------------------------------------------------





More information about the use-livecode mailing list