popup in selected text in unlocked field

Jan Schenkel janschenkel at yahoo.com
Sat May 21 05:42:50 EDT 2005


--- Stephen Barncard <stephenREVOLUTION at barncard.com>
wrote:
> 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...?..
> 
> thanks
> 
> sqb
> 

Hi Stephen,

The following trick works on both Win and Mac: set the
traversalOn of the popup menu button to false, and the
selectedChunk will remain the same -- I used this sort
of construct in one project:

## field script
on mouseDown pButton
  if pButton = 3 then popup button "FieldMenu"
end mouseDown

## popup button script
on menuPick pItem
  switch pItem
  case "cut"
    cut
    break
  case "copy"
    copy
    break
  case "paste"
    if the clipboard is "text" then paste else beep
    break
  case "clear"
    delete
    break
  end switch
end menuPick

## And this works remarkably well...

Hope this helped,

Jan Schenkel.

Quartam - Tools for Revolution
<http://www.quartam.com>

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)


		
__________________________________ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 


More information about the use-livecode mailing list