Glossary and hyperlink
Thomas J McGrath III
3mcgrath at adelphia.net
Tue Oct 28 14:52:52 EST 2003
Hello all,
Same project, I need to make each line in the text field a link to
either an external file or another substack window to open over top of
the main stack. BUT I also want a glossary effect that when the mouse
is over words in the text to display a glossary in a separate field.
The glossary seems to be done by the link text item and the hyperlink
seems to also work best there as well.
So I put the link as the external file/substack link and an underline
text style as the glossary look up.
This works except what I want is something like single click ( or
better yet mouseover) on line shows glossary item if over glossary text
item and THEN double click same line opens external file/substack. Or
something like this.
tom
local storedHilitedChunk -- stores the highlighted text location
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 then -- then check it
if "link" is in the textStyle of the mouseChunk then --if link then
set color and do something
set the backgroundColor of the mouseChunk to "pink"
-- Go link to external file or substack
put the mouseChunk into storedHilitedChunk -- saved for later
unhighlighting
else -- not link then check underline
if "mixed" or "underline" is in the textStyle of the mouseChunk
then
set the backgroundColor of the mouseChunk to "yellow"
-- Go glossary look up
put the mouseChunk into storedHilitedChunk
end if
end if
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
Thomas J McGrath III
Advanced Media Group
220 Drake Rd.
Bethel Park, PA 15102
3mcgrath at adelphia.net
More information about the use-livecode
mailing list