changing textStyle on the fly

Howard Bornstein bornstein at designeq.com
Sun Dec 22 14:05:01 EST 2002


I'm not sure how your example would work, since by clicking your button, 
you've changed the location of ClickLoc.

In anycase, if you put the following script into your field, it should do 
what you want:

on mouseup
  put the clickchunk into tClicked
  if tClicked is not empty then
    put the textStyle of tClicked into tStyle
    if tStyle is "link" then
      set the textStyle of tClicked to "plain"
      put the mousetext after fld "Display"
      set the textStyle of tClicked to "link"
      hide groups
    else
      put the clickText after fld "Display"
    end if
  end if
end mouseup

Regards,

Howard Bornstein
____________________
D E S I G N  E Q
www.designeq.com



>I have a field which has some words linked together.  Under certain 
>conditions, I want the mouse click to disregard the link and handle the 
>individual words which make up the link.  So I wrote a script to check 
>if the clicked text is a link, change its textstyle to plain, pick up 
>the word at clickLoc, do something with the word, and then make the 
>originally cliked chunk into a link again.
>
>
>on mouseDown theButton
>   switch
>   case theButton is 1
>     put the textStyle of the selectedChunk into tStyle
>     put the selectedChunk into tChunk
>     if tStyle is "link" then
>       set the textStyle of the selectedChunk to "plain"
>       click at the clickLoc
>       put the clickText after fld "Display"
>       select tChunk
>       set the textStyle of the selectedChunk to "link"
>       hide groups
>     else put the clickText after fld "Display"
>     break
>  end switch
>end mouseDown
>
>What am I doing wrong?  With the above script, I still get the linked 
>words displayed together, not individually, as I would want them.
>
>I'd be most grateful for any help.
>
>Happy holidays to everybody!
>
>Toma



More information about the use-livecode mailing list