dynamically adding links with textStyle, linkText, and an ask dialog
Curt Ford
cford at sc.edu
Tue Apr 3 15:46:52 EDT 2007
In my project I want to let users enter text into a field, then
highlight some text to add a link; the field contents are then saved
to a text file to be read in later & displayed with an active link.
This works fine, attached to a button for adding a link:
on mouseUp
set the textStyle of the selectedText to "link"
set the linkText of the selectedText to "http://www.google.com"
put the HTMLText of fld "source" into fld "resultHTML" --a check
to see how it looks
end mouseUp
But when I try to let the user enter a link with:
on mouseUp
ask "Please enter a link:"
put it into tLink
set the textStyle of the selectedText to "link"
set the linkText of the selectedText to tLink
put the HTMLText of fld "source" into fld "resultHTML"
end mouseUp
..the link ends up following the text that was selected; so if in
"one two three" the "two" was highlighted, the result is:
<p><font face="Geneva">one two<a href="www.google.com"></a> three</
font></p>
Is there a way I can keep the ask dialog box from interfering with
the selection?
Curt
Dr. Curtis Ford
Instructor of Russian and Linguistics
Dept of Languages, Literatures and Cultures
University of South Carolina
cford at sc.edu
More information about the use-livecode
mailing list