Selecting a word

Ken Ray kray at sonsothunder.com
Fri Dec 21 02:01:01 EST 2001


Re: Selecting a wordIf you want to click on a locked field and put a rectangle around it, you can use this:

on mouseUp
  set the textStyle of the clickText to box
end mouseUp

You'll have to clear the box style for each successive click, but you get the idea...

Ken Ray
Sons of Thunder Software
Email: kray at sonsothunder.com
Website: http://www.sonsothunder.com/
  ----- Original Message ----- 
  From: Stuart Milliken 
  To: use-revolution at lists.runrev.com 
  Sent: Friday, December 21, 2001 12:15 AM
  Subject: Re: Selecting a word


  >I am having a problem finding a command to select a word
  >and put it into a container...
  >I'd like to click on a word, show a rectangle around it (like in 
  >Hypercard) or color it, and put it into a variables container.


  I'm not 100% sure if this is what you want, but the following works in a field's script for double-clicking on a word in an unlocked field to put the word in a container.  (For an unlocked field I assume you don't want to interfere with single-clicking.)

  on selectionChanged
    put the ticks into t
    repeat until the mouseClick
       if the ticks - t > the doubleClickInterval then exit to top --SEE NOTE BELOW
    end repeat
    if the clickChunk = "" then exit to top
    select the clickChunk --OPTIONAL, TO HILITE THE WORD
    put the clickText into someContainer
  end selectionChanged

  (NOTE: "the doubleClickInterval" gives me a number apparently in milliseconds, though the documentation says it should be in ticks on a Mac.  Perhaps this is somehow due to my non-Mac (Logitech) mouse. If this is also the case for you, substitute literal value for a reasonable number of ticks, like 20.) 

  If you have a mouse with a right button, the following also works to (right) single-click (for me anyway):

  on mouseUp
    select the clickChunk --OPTIONAL, TO HILITE THE WORD
    put the clickText into someContainer
  end mouseUp

  This works without specifying a mouse button parameter because, for some reason, the mouseUp message evidently is only sent to the field if you right-click and not if you left click.

  If the field is locked and you just want to single-click in the normal way on the word, the above mouseUp handler works too.

  Hope this helps,

  Stuart Milliken


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.runrev.com/pipermail/use-livecode/attachments/20011221/4cf68095/attachment.html>


More information about the Use-livecode mailing list