Reputation: 31
I use the create
command in livecode to dynamically create several objects (graphic, field, button) depending of some conditions. I use "lock screen" and set up all properties: width
, height
, textSize
and many many more... Then "unlock screen".
Here is the problem:
The syntax create btn "Rider1"
creates a standard button, but I need an ption menu button. In the project browser, there is also an option menu "Button: Rider2Number", but trying to modify the button that was created by script fails: there is no option menu or popup menu in the list of button types. There are opaque and standard and some variations. It seems like the standard button and the option menu are two different objects. Which prefix (like btn
) I should use to create an option menu by script?
Upvotes: 1
Views: 552
Reputation: 756
You have to first the the style of the button, then set its menuMode:
set the style of last button to "menu"
set the menuMode of last button to "comboBox"
There are two ways to fully set the required properties:
1- If you already have an option button (call it "XYZ"), you can:
create button
set the properties of last button to the properties of btn "XYZ"
You then will need to modify things, like its name and contents.
2- You can set the properties of the "templateButton" as required, perhaps, again, to the properties of btn "XYZ". Then all new buttons will start off that way. You will still have to modify a bit as in the above case.
This is all so that you need not set the many properties that distinguish one type from another; that is tedious. Look up the "templateButton" in the dictionary. This property can be set on the fly, to any number of different types of buttons. Do you see? If you had a suite of button styles, you set the properties of the templateButton to any of those on the fly, and then any newly created button will be of that type.
Upvotes: 1
Reputation: 756
There is only one button object class. The difference between the many types you are interested in is the "menuMode". Check this out in the dictionary.
Upvotes: 0