VS: VS: Newbie: get hyperlink working?

Jan Schenkel janschenkel at yahoo.com
Tue Sep 10 05:24:01 EDT 2002


--- Esa_Kivelä <Esa.Kivela at ncrc.fi> wrote:
> 
> [snip]
> 
> Hmmm that button write that typed text fron text
> field into www-page (don't ask me users just want
> that).
> So if INSIDE text field is like httP://ncrc.fi so
> when button is pressen how it can write that
> "http://ncrc.fi" as link into www page not as text
> from text field? 
> 
> EsaK

Hi Esa,

If I understand you correctly, you want a text field,
where users can type in all sorts of stuff, and then
select a chunk of text, and click a button "Make link"
to add a HREF style link.

In that case, try the following:
1) set the button's "autoHilite" off
2) set its script to:
  on mouseUp
    put the selectedChunk into tChunk
    if tChunk is not empty and (word 4 of tChunk >= \
    word 2 of tChunk) then # there is a selection
      put the value of tChunk into tLink
      # you could adapt tLink (eg: prepend "http://")
      set the textStyle of tChunk to "link"
      set the linkText of tChunk to tLink
    end if
  end mouseUp

If that wasn't what you wanted, I hope it helped
anyway, and you're always free to post another
clarification.

Best regards,

Jan Schenkel.

"As we grow older, we grow both wiser and moire
foolish at the same time."  (De Rochefoucald)

__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute



More information about the use-livecode mailing list