Link text but like the Rev docs

Barry Levine themacguy at macosx.com
Sun Aug 31 00:45:01 EDT 2003


Maybe this will be useful. The Rev docs give an example of how to have 
link text automatically highlight yellow when the mouse passes over it 
(like the Rev online docs). However, only passing mention of how to 
make it not -look- like "link text" is given; the reference says that 
the Property Inspector is used to effect the changes. This is only 
partially correct.

You need to change the "Normal" Link Color to black (or whatever color 
the rest of the text is). This may be done in the Inspector. But you 
also need to script or go to the message box with this command:

set the underlinelinks of this stack to false

Now the link text looks just like the rest of the text in that field. 
The code that would go into the field script which would make the link 
text highlight automatically is as follows:

--------------------------------------------
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
--------------------------------------------

The above script is copied from Jeanne's posting of 9/30/02. Yes; it 
works fine! (and thank you, Jeanne)

Regards,
Barry




More information about the use-livecode mailing list