Segmented Button Object

A Segmented Button Object usually acts like a group of radio buttons.

but it can also act like a series of checkboxes (called Toggle mode).

or as a series of push buttons (called Momentary mode).

#### Creating a Basic Segmented Button

Start by dragging a segmented button object from the Object Library to the form. Then enter the name of of the field or variable that will be linked to the segmented button. Finally, switch to the Formula panel and enter the button names, separated by commas (you can optionally include spaces, as shown below).

For a basic segmented button, that’s it … you’re done!

#### Segmented Button Options

Here are the options for a Segmented Button object:

#### Mode

There are three possible modes of operation – Radio, Toggle and Momentary.

Radio – This is the default mode. In this mode the buttons act like a group of radio buttons. Only one button can be selected at a time. The name of the currently pressed button will be placed in the field or variable the object is linked to (see Data below). This also works in reverse – changing the value of the field or variable will change the button state (in the case of a variable, you must also use the showvariables statement).

Toggle – In this mode, the buttons act like a group of checkboxes. Each time you press a button it will toggle on or off (hence the name), and multiple buttons can be selected at once.

If multiple buttons are selected, multiple values will be placed in the field or variable the object is linked to (see Data below). Each value will be separated from the next by the text specified in the Value Separator option (see below). In this example, the Value Separator is a comma and space. The linked value is displayed in a Text Display object so that you can see what is going on “under the hood”.

If the Value Separator is left blank then carriage return will be used as the separator.

Momentary – In this mode, the buttons act as independent checkbox. Each button will highlight as you press it, but the buttons will not stay selected. The only effect of clicking on a segmented button in this mode is to trigger the procedure code associated with the object.

#### Data

This option specifies the data that is to be edited. You can either type in the name of a field or variable, or you can choose a field name from the pop-up menu (on the right). Panorama will also auto-complete field names as you type.

Note: If you specify a variable that has not already been created with a procedure, Panorama will automatically create a global, fileglobal or windowglobal variable with this name the first time the form is displayed. The type of variable created depends on the Form Preferences.

#### Comma Separated Values/Formula Mode

This pop-up controls how the formula is interpreted. See Dynamic Segmented Buttons at the bottom of this page to learn more.

Value Separator – This is the text that will appear between each value in a multiple value list. Common separators include commas, spaces, slashes and hyphens. This option only applies if the Toggle option is used (see Mode above), for other modes the Value Separator is ignored. The Value Separator may be a multi-character separator like comma+space.

If the Value Separator is left blank then carriage return will be used as the separator.

#### Style

Panorama X makes available all of Apple’s style options for this type of object.

#### Evenly Divided Button Widths

Normally the button’s segments are displayed at the minimum width necessary for each segment. If the Evenly Divided Button Widths option is set, the buttons expand to the entire width of the object, and are divided evenly no matter what the width of each segment name.

If there are too many buttons, it will do the best it can.

Size – Segmented buttons may be one of three fixed heights: Regular, Small and Mini. These are the only sizes available – see Cocoa Objects for more detail about the reasons for this limitation.

System Font – If this option is checked, the segmented buttons will always be displayed using the standard system font and font size. Uncheck this option if you want to use a non-standard font or size (in which case you select the font and size from the Text panel, see Fonts).

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. See Push Button Objects for an explanation of how a procedure can enable/disable a button.

#### Dynamic Segmented Buttons

The examples shown so far have been fixed – buttons that never change. If you need a segmented button that can change dynamically, switch the object to Formula mode. You can even add or remove buttons.

In this mode, the Formula panel actually contains a formula, instead of a comma separated list. Here is the revised formula for our compass direction example. Notice that now each direction is on a separate line, and also note the quote characters at the beginning and end, which are necessary to make this a valid formula.

One minor advantage of this mode is that it allows button names to contain commas, which isn’t allowed in the Comma Separated Values mode. But the real power of Formula mode is unleashed when you use a variable or field in the formula. Since the variable or field may be changed at any time with a procedure (or even with standard data entry), the button arrangement can change at any time. For example, suppose you want to make an editable pizza topping list. I can create a Text Editor Object linked to a variable named ToppingNames, like this:

Then I can change the segment button formula to this same variable name.

Now the button arrangement can be edited on-the-fly.

In this example, the formula is very simple, just a single variable, but you can use as complex a formula as you need.

#### Diagnosing Formula Problems

If your formula has a problem it can be a bit tricky to figure out what’s wrong since you can’t directly see the text produced by the formula. In that situation you can use the Object Value dialog to display the entire formula result. See Diagnosing a Formula embedded in a Form Object to learn how to use this dialog.

See Also

- Adjusting Object Spacing -- adjust the spacing between multiple selected objects so that the same amount of space is in between each pair of objects.
- adjustobjectspacing -- adjusts the spacing of selected objects in a form.
- adjustobjectspacingdialog -- opens a dialog sheet to adjust the spacing of the currently selected objects.
- Aligning Objects -- so that two or more object edges are made even with each other.
- Automatic Form Construction -- creates a column of form elements for editing data fields (or variables).
- Automatic Mailing Label Construction -- creates a mailing label.
- Automatic Report Construction -- creates a tabular report with columns of data.
- Cocoa Objects -- discussion of how objects are implemented in Panorama X compared to earlier versions
- Creating a New Form Object -- with the Object Library.
- Data Button Object -- is used to create checkboxes and radio buttons.
- Diagnosing a Formula embedded in a Form Object -- diagnosing problems with formulas embedded in form objects.
- Displaying Data in a Grid -- fundamentals of displaying data in a grid (Text List/Matrix).
- Duplicating Objects -- to make copies of one or more objects.
- Fixed Image Object -- is used for fixed images (images that never change).
- Fonts -- setting the font and text size of form text objects.
- Form Object Appearance -- changing the color, fill, stroke, opacity and drop shadow attributes of selected objects.
- Form Object Blueprint -- display and edit raw object specifications
- Form Object Code -- associating programming code with an object
- Grouping Objects -- allows you to manipulate multiple objects as if they were a single object.
- Image Display Animations -- animated images.
- Image Display Colors and Gradients -- displaying pure colors and gradients
- Image Display Data Buttons -- checkboxes and radio buttons created from custom images.
- Image Display Object -- is used for dynamic images (images that change depending on the data).
- Image Display Push Buttons -- push buttons created from custom images.
- info("clickedobjectname") -- returns the name of the button that was just clicked.
- Line Item Grid Constructor -- creates a grid of form elements for displaying and editing line item fields.
- Line Object -- draws a line within a form.
- Matrix Clicking -- handling clicks in a Matrix Object.
- Matrix Constructor -- quickly creating a Matrix Object from a template.
- Matrix Database Integration -- synchronizing a Matrix Object with a database.
- Matrix Geometry -- customizing the size and geometry of Matrix Object elements.
- Matrix Header and Horizontal Scrolling -- setting up a custom header for a Matrix Object grid.
- Matrix Object -- displaying a grid of items with a custom arrangement.
- Matrix Object Frame -- setting up the arrangement of items within a Matrix Object.
- Matrix Programming -- programming a Matrix object.
- Object Inspector Panel -- is used to view and modify the attributes of selected objects in a form.
- Object Library -- is used to create new objects in a form.
- Object Names -- can be used to identify an object in a program.
- Oval Object -- draws an oval or circle within a form.
- Polygon Object -- draws a polygon within a form.
- Popup Menu Button Object -- is used to create popup menus anywhere on a form.
- Progress Indicator Object -- is used to create progress indicators
- Push Button Object -- triggers a procedure when it is pushed.
- Rectangle Object -- draws a rectangle or square within a form.
- Report Tile Object -- component for assembling a custom report.
- Rounded Rectangle Object -- draws a rectangle with round corners within a form.
- Scroll Bar Object -- is used to create scroll bars.
- Selecting Form Objects -- so that they can be modified.
- Slider Object -- is used to create sliders and knobs.
- Smart Resize -- adjusts the sizes and locations of the other selected objects to match the change of one object.
- Star Object -- draws a star within a form.
- Stepper Object -- is used to create numeric steppers for use with Text Editor objects.
- Tab Panel Appearance -- appearance options for a Tab Panel Object.
- Tab Panel Buttons and Selection -- button options for a Tab Panel Object.
- Tab Panel Constructor -- quickly creating a Tab Panel Object from a template.
- Tab Panel Content -- setting up the content for a Tab Panel Object.
- Tab Panel Forms -- setting up the forms for a Tab Panel Object.
- Tab Panel Object -- switchable tab panels.
- Text Display Object -- is used to display text using a formula.
- Text Editor Object -- is used to edit text in a field or variable.
- Text Label Object -- displays a short, fixed, text item within a form.
- Text List Appearance -- customizing the appearance of a Text List Object.
- Text List Constructor -- quickly creating a Text List Object from a template.
- Text List Database Integration -- synchronizing a Text List Object with a database.
- Text List Multiple Columns -- displaying multiple columns in a Text List Object
- Text List Object -- displaying a grid of text.
- Text List Programming -- programming a Text List Object.
- Text List Searching -- searching within a Text List Object.
- Text List Selection -- selecting items in a Text List Object.
- Text Object Background Color/Gradient -- text object background colors and gradients.
- Web Browser Object -- is used to display web pages from within a Panorama form.

History

Version | Status | Notes
10.0 | New | New in this version.