hilite, double-click etc.

Jeanne A. E. DeVoto jeanne at runrev.com
Mon Sep 30 00:03:01 EDT 2002


At 1:33 PM -0700 9/26/2002, Toma Tasovac wrote:
> I would like to be able to add certain grammatical and stylistic
>explanations which would not be linked to particular words, but rather to
>some difficult phrases, metaphoric expressions etc.  So, I wonder if one
>could turn some chunks of text into links which would get highlighted with
>mouseOver (as in Revolution Documentation) - pointing thus that there is a
>note attached to that phrase (not all sentences will have them, of course)
> and THEN have the link activated with a control-click or double-click
> (since single click should be reserved for individual words), displaying
>the note in the field  Translation Display. 

Here's a quickie version of the highlighting code in the documentation:

----------
local storedHilitedChunk

on mouseMove
  -- first unhighlight the "old" phrase if necessary:
  if storedHilitedChunk is not empty \
      and storedHilitedChunk is not the mouseChunk then
    do "set the backgroundColor of" && \
        storedHilitedChunk && "to empty"
    put empty into storedHilitedChunk
  end if
  -- highlight if the text under the mouse is linked:
  if the mouseChunk is not empty \
      and "link" is in the textStyle of the mouseChunk then
    set the backgroundColor of the mouseChunk to "yellow"
    -- saved for later unhighlighting
    put the mouseChunk into storedHilitedChunk
  end if
  pass mouseMove
end mouseMove

on mouseLeave
  -- unhighlight any currently highlighted text:
  if storedHilitedChunk is not empty then
    do "set the backgroundColor of" && \
       storedHilitedChunk && "to empty"
    put empty into storedHilitedChunk
  end if
  pass mouseLeave
end mouseLeave
----------

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list