Page 1 of 1

name of button disappeared

Posted: Mon Dec 31, 2007 9:31 pm
by rstevenson
Hello,

Just messing around and getting started. I created a button of type Pull Down, put a small script into it. When it worked, I duplicated it several times. The names remained the same, and there was a small change in each script. Not efficient I know, but it worked.

Then, wondering what the other button types were like, in the dev environment I selected one of my Pull Down buttons and under Basic Properties/Type I selected each of the other types, ending up back at Pull Down.

The name of this button is now missing, and nothing I've tried -- including renaming it -- has managed to get the name back.

I know I can just delete it and make a new one, but ... any ideas what's going on?

Rob

Posted: Tue Jan 01, 2008 12:39 am
by malte
Hi Rob,

I suspect the button will have its label property set. Try this in the message box:

set the label of button "myButton" to empty

This might not work as you have more than one button with the same name. So you might try this:

type in message box:

set the label of the mouseControl to empty

but do not hit enter yet. Instead move the mousepointer over the button with the "missing" name and hit enter then.

Hope this helps,

Malte

Posted: Tue Jan 01, 2008 2:31 pm
by rstevenson
Thanks Malte. The second command worked; the name reappeared.

So am I to assume that setting the button type to any other type will cause this? Or is it just one of the types? Is this a bug or a "feature"? :P

By the way, in the inspector (is that what that window is called?) there was nothing in the label field, but setting it to empty worked anyway.

Rob

Posted: Tue Jan 01, 2008 2:58 pm
by malte
It is a feature.

If you use a combo box or option menu, the label property will reflect the users choice.

A button can have a property called text. Each line of the text of a button reflects a menu option.

All the best,

Malte

Posted: Tue Jan 01, 2008 3:22 pm
by rstevenson
Thanks again Malte,

I understand now -- makes perfect sense. Though perhaps if choosing either Option menu or Combo box sets the label property to something, choosing one of the other button types should quietly reset the label property to empty. Maybe the devs can fix that when they've got lots of time on their hands. :P

Posted: Tue Jan 01, 2008 9:04 pm
by malte
HI Rob,

that would require a fair amount of tea leave reading by the engine ;-)

You can always change the label property for a button yourself. Imagine a situation where you want to loop over a set of buttons in a repeat loop. You name the butons "myButton 1", "myButton 2",...,"myButton 10"

Now you have a construct like

repeat with i=1 to 10
set the icon of btn ("myButton"&&i) to the ID of img ("myImage"&&i)
end repeat

The names make perfect sense in a programatical way, however your users will most likely not know what the buttons actually do, so you set the label property of the buttons to display a more descriptive string to your end users.

set the label of btn "myButton 1" to "play"
set the label of btn "myButton 2" to "Quit"
etc.

Setting the label is also helpful when localizing your app.

Long blahblah short, the engine will not know if you explicitly have set the label or if the setting of the label has happened when playing with the other properties.

All the best,

Malte