script questions

Jeanne A. E. DeVoto jeanne at runrev.com
Sat Feb 9 02:21:41 EST 2002


At 6:20 AM -0800 2/7/2002, Steve Messimer wrote:
>Hi,
>
>I would like to implement text that hilites itself on mouse over like RR
>uses in its documentation.  Anybody have an script example I could look at?

Here's an example I posted a few weeks back, replying to a similar query:

---------

Here's a simplified version which you can place in a field's script. To
make a word or phrase "highlightable", change its text style to "link". You
may also want to turn off link coloring and link underlining in the Stack
Properties palette.

on mouseMove
  -- first unhighlight the "old" phrase if necessary
  if the storedHilitedChunk of this stack is not empty \
      and the storedHilitedChunk of this stack is not the mouseChunk then
    do "set the backgroundColor of" && \
        (the storedHilitedChunk of this stack) && "to empty"
    set the storedHilitedChunk of this stack to empty
  end if
  if the mouseChunk is not empty \
      and "link" is in the textStyle of the mouseChunk then
    set the storedHilitedChunk of this stack to the mouseChunk
      -- save for later unhighlighting
    set the backgroundColor of the mouseChunk to "yellow"
  end if
  pass mouseMove
end mouseMove

on mouseLeave
  if the storedHilitedChunk of this stack is not empty then
    do "set the backgroundColor of" && \
       (the storedHilitedChunk of this stack) && "to empty"
    set the storedHilitedChunk of this stack to empty
  end if
  pass mouseLeave
end mouseLeave

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!





More information about the use-livecode mailing list