popup in selected text in unlocked field

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri May 20 03:19:53 EDT 2005


Hi Stephen,

I have seen Xavier answer.
Unfortunately, it does not work with Mac OS: you can't prevent text  
deselection when popping up a menu.
But ;-)
Only a "not really satisfying" workaround:

Set the hiliteColor of your field ("#B5D5FF" for standard Mac OS for  
instance).
Then, in the script of your field:

on mouseDown pButton
   local tChunk
   -----
   if pButton = 3 then
     put the selectedChunk into tChunk
     if word 4 of tChunk > word 2 of tChunk then
       set the backcolor of the selectedChunk to the hiliteColor of me
       popup btn "MyMenu"
     end if
   end if
end mouseDown
--------------------------
on selectionChanged
   set the backcolor of char 1 to -1 of me to empty
end selectionChanged

Best regards from Paris,

Eric Chatonet.

Le 20 mai 05 à 06:56, Stephen Barncard a écrit :

> I know there's some kind of trick here to do this;
>
>
> I have an unlocked, editable field with text. I select a portion of  
> the text, then option click on it for a popup that has a few  
> options to select from to do something to the text, like uppercase,  
> lowercase, etc.
>
> This changing works with a button and an option menu combo, but not  
> in a contextual button. Any activity on the field kills the selection.
>
> Attempting this always loses the selection, then there's nothing to  
> change, and all attempts to save the selection range description to  
> a global still don't seem to work.
>
> I'm sure there's a dance of locking and unlocking to get this to  
> work, but I haven't found it yet... any ideas...?..

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Plugins, tutorials and more on our website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------



More information about the use-livecode mailing list