Show Linktext on mousemove
FlexibleLearning
admin at FlexibleLearning.com
Mon Jan 24 13:03:12 EST 2011
HoverLink...
How to change the cursor and tooltip on linktext mouseOver. This example
handles a field that is normally unlocked, but allows the user to click and
activate the contents on mouseOver.
-------------------------------------------------
>From The Scripter's Scrapbook
local tLinkChunk
on mouseMove
if (the selectedtext is NOT empty) then pass mouseMove
if (the mouse is down) OR (the controlKey is down) then pass MouseMove
if (the mouseChunk is not empty) AND (the mouseChunk=tLinkChunk) then pass
mouseMove # Avoid repeated check on the same text
if (tLinkChunk is NOT empty) AND (tLinkChunk is NOT the mouseChunk) then
restoreStyle
exit mouseMove
end if
if (the mouseChunk is NOT empty) AND ("link" is in the textstyle of the
mouseChunk) then adjustStyle
pass mouseMove
end mouseMove
on adjustStyle
-- Adjust style
set the lockText of me to TRUE --| Or ignore this line to leave the fld
locked
put the mouseChunk into tLinkChunk
set the cursor to 8
set the lockCursor to true
set the tooltip of me to the linkText of the mouseChunk
end adjustStyle
on restoreStyle
-- Restore style
set the lockText of me to FALSE
if tLinkChunk is empty then
exit restoreStyle
end if
put empty into tLinkChunk
set the lockCursor to false
set the tooltip of me to ""
end restoreStyle
-------------------------------------------------
May be of some use to you.
Best wishes
Hugh Senior
FLCo
-- Original Message
Date: Sun, 23 Jan 2011 12:48:11 -0800 (PST)
From: Alejandro Tejada <capellan2000 at gmail.com>
Hi Jeff,
I found a reliable way to recreate the error everytime.
The condition that trigguers the error occurs only when
mouseText (or mouseCharChunk) is empty.
Adding another condition: "the mousetext is not empty"
to IF, THEN, ELSE solves the error:
on mousemove
if the hilite of button "ShowLinkText" and the mousetext <> empty and \
the linktext of the mousetext <> empty
then
put "Actual link is: " & the linktext of the mousetext into fld
"ActualLink"
set the textcolor of char 44 to -1 of fld "ActualLink" to blue
else
put empty into fld "ActualLink"
end if
end mousemove
Many thanks for your idea, Jeff! :-)
Al
--
More information about the use-livecode
mailing list