set selectedText?

Martin Baxter martin at materiaprima.fsnet.co.uk
Thu Nov 18 07:54:54 CST 2004


>What is wrong with this:
>
>set the selectedtext of btn 1 to "one"
>?
>
>I get:
>
>Script compile error:
>Error description: Properties: token is not a property
>
>How can I get an option button to select a particular text that is already
>in the text of the button?
>
>Any background guidance as to what I am missing would be welcome!
>--
>
>Kaveh Bazargan

I do it like this:

set the wholematches to true
put lineoffset("one",btn 1) into lnum
if lnum > 0 then
  set the menuhistory of btn 1 to lnum
end if

You can use the selectedtext to find out what the selectedtext is, but I
don't think you can set it as the selectedtext is a function not a property.

If you change the label of the option button, this changes what the user
sees, but it doesn't change the selection.

So if a button's menuhistory is 1, and line 1 of the button contains the
text "Line one", changing the label of the button to "Line two" changes
what the user sees, but the menuhistory property is still 1 and the
selectedtext still returns "Line 1"

Of course this may or may not be an issue depending on the circumstances.

I hope that makes sense :-)

Martin Baxter




More information about the use-livecode mailing list