Yet another menu question

Jan Schenkel janschenkel at yahoo.com
Mon Dec 30 07:15:01 EST 2002


--- Graham Samuel <livfoss at blueyonder.co.uk> wrote:
> Sorry for all these naive questions, but it says in
> the 1.1 docs:
> 
> "to create individual menu items that will appear in
> the menu, set 
> the button's text property to the menu's contents,
> one menu item per 
> line. You can either set this property in a handler,
> or fill in the 
> box..."
> 
> I wanted to use this feature to change the text of
> individual menu 
> items (for example to create menu item that toggles
> between "Show..." 
> and "Hide...".
> 
> Well, if I execute in the message box
> 
>    put line 1 of the text of button "Options" of
> card 1 of this stack
> 
> I get the result I expected (a text, say "Show the
> picture" - without 
> the quotes, of course). But if I try to execute
> 
>   set line 1 of the text of button "Options" of card
> 1 of this stack to "Blah"
> 
> I get an error "Object can't set this property".
> 
> What am I doing wrong?
> -- 

Hi Graham,

The reason why this doesn't work is that it can't find
a property named "line 1 of the text".
Try this:
  put "Blah" into line 1 of the text of button \
    "Options" of card 1 of this stack
Or a bit clearer and better in case you have to make
multiple changes:
  put the text of button "Options" of card 1 of \
    this stack into tMenuText
  put "Blah" into line 1 of tMenuText
  set the text of button "Options" of card 1 of \
    this stack to tMenuText

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!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



More information about the Use-livecode mailing list