Contextual (popup) menus and their options

Eric Chatonet eric.chatonet at sosmartsoftware.com
Mon Aug 25 06:18:52 EDT 2008


Bonjour Mark,

Sorry if I was not clear enough.
As I said, the selectedChunk, that returns a chunk expression  
describing the location of the text selection or insertion point, is  
always something like char 4 to 3 of field 1 (insertion point is  
placed after char 3 but there is no text selection), char 4 to 4 of  
field 1 (char 4 is selected), char 1 to 4 of field 1 (char 1 to 4 is  
selected).

word 1 of the selectedChunk = 'char'
word 2 of the selectedChunk = <integer>
word 3 of the selectedChunk = 'to'
word 4 of the selectedChunk = <integer>
etc.
These integers are those that interest us :-)

'char 4 to 3 of field 1' -> '2 < 4' ->' word 2 < word 4' -> insertion  
point but no selected text
'char 1 to 4 of field 1' -> '1 < 4' ->' word 2 > word 4' -> selected  
text

Why word 4 is less than word 2?
A simple convention to distinguish when the insertion point is in the  
field if there is some selected text also or not.
When word 4 is less than word 2, this means that the insertion point  
is in the field after char 'word 4 of the selectedText' but there is  
no selected text.
If word 4 is more than word 2, this means that char 'word 2 of the  
selectedText' to 'word 4 of the selectedText' are currently selected.

See selectedChunk, selectedField, selectedText in the docs.

Le 25 août 08 à 00:57, Mark Stuart a écrit :

> But I'm not sure what this part of your script does, what it is  
> checking
> for?
>
>
>
>    if word 4 of the selectedChunk < word 2 of the selectedChunk then
>
>
>
> Why word 4 and why word 2?
>
> And why word 4 is less than word 2?

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