In many ways the most important component of a push button is the code it triggers. In fact this is so important that it is a separate topic – see Form Object Code to learn all the details.
The magic panel for push button objects contains about a half-dozen options.
Each of these options is discussed in detail below.
Title – The first option is the title that appears on the push button.
If necessary, the code in the button can use the objectinfo( function to find out what the title of the button is:
The info(“trigger”) also returns the name of the button, prefixed with
Button. (for example
Style – This option specifies the style of the button. Use the pop-up menu to pick the style you want. (The first option, Push Button, is the default style.)
Only styles supported by OS X are included (see Cocoa Objects to learn more).
Size – Most push button styles are available in three sizes: Regular, Small and Mini. (See Cocoa Objects to learn the reason for this limitation.)
There are 4 push button styles that can have variable height, as shown here. For these styles, the Size popup controls the size of the button title, but not the height of the button.
This animation shows the difference between button styles that are only available in three heights and styles that allow any height.
System Font – If this option is checked the button title will always be displayed using the standard system font and font size. If you want to use a non-standard font or size, first uncheck this option, then choose the font and size from the Text panel (see Fonts).
Rich Text – If this option is checked the button title can include rich text tags for different styles, fonts, colors – even icons.
Transparent – If this option is checked the button will be completely transparent (the title will also be hidden). This is handy if you want to put the button on top of other graphics. (Note: Making the button transparent also changes the way the button responds to clicks. Instead of triggering the procedure when you release the mouse, a transparent button will trigger the procedure immediately when you click on the mouse.)
In previous versions of Panorama it was very common to put a transparent button on top of an image to create a custom button. This looked nice, but made editing the form more complicated because the two objects were stacked on top of each other. In Panorama X this technique is no longer necessary because you can put the code right into the Image Display object – in other words the Image Display button becomes an push button itself.
In fact, in Panorama X any type of object can be a push button – an image, a rectangle, a star, even text. So it’s usually no longer necessary to go thru the extra complication of adding a transparent push button on top of other objects.
Default Button – If this option is checked the button becomes the default button. The default button is blue (and if anyone is still running OS X 10.9 Mavericks, you’ll see that the button throbs).
If you press the Return or Enter key when no text editor is active, Panorama will automatically trigger the procedure associated with the default button. Because of this, you should never set the Default option for more than one button on a form. If you do, it is not predictable which button will be triggered.
Disabled – This option disables the button. When the button is disabled it is dimmed and it can’t be clicked on.
Of course there is no point in a button that is permanently disabled. So normally you would enable/disable a button with a procedure.
To access a button (or any object) with a procedure, it must have a name. We’ll call this button Love Button.
For this example we’ll create a checkbox that will be programmed to enable and disable the push button. See Data Button Object to learn more about checkboxes. This checkbox is has been set up with a variable named loveEnabled, which will toggle between YES and empty.
Here is the code that is triggered when the checkbox is clicked. This code will enable and disable the Love Button push button. See Modifiable Object Properties to learn about object properties that can be changed by the ChangeObject statement.
That’s it! Clicking on the checkbox now enables and disables the main push button.
|10.0||Updated||Carried over from Panorama 6.0 from Push Button SuperObjects, but with some new features, including rich text and the ability to be disabled. This version of Panorama only supports standard system button styles, so some button styles that were available in previous versions of Panorama are no longer available.|