Creating links

Jan Schenkel janschenkel at yahoo.com
Thu Oct 24 00:22:01 EDT 2002


--- Terry Judd <tsj at unimelb.edu.au> wrote:
> OK, surely this can't be difficult. How do I select
> some text in a 
> field and then set its linkText property without
> having to resort to 
> "set the linkText of..." in the message box? I'm
> having real problems 
> even querying the selectedChunk given that it
> automatically deselects 
> as soon as I click in the message box (or anywhere
> else for that 
> matter).
> 
> Cheers,
> 
> Terry...
>

Hi Terry,

This may sound too obvious, but in the menu "Text" you
can choose the item "Link" to set the style of the
selected chunk.

Either that, or you'll have to add a small button with
the property 'traversalOn' set to false so the
selection doesn't change, with script:

  on mouseUp
    if the selectedChunk is empty then exit mouseUp
    put the textStyle of the selectedChunk into tStyle
    switch
    case tStyle is "plain" or tStyle is empty
      set the textStyle of the selectedChunk to "link"
      break
    case "link" is not among the items of tStyle
      set the textStyle of the selectedChunk to \
        (tStyle & comma & "link")
      break
    end switch
  end mouseUp

That should take care of the situations where there's
no selection or the entire selection already has a
style of its own -- you'll have a bit more work to do
if you want to prserve the style of a chunk within the
selectedChunk.

Hope this helped,

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/



More information about the Use-livecode mailing list