skip to main content
OpenEdge Development: AppBuilder
Control Objects : Basic buttons
Basic buttons
In a GUI, a button is equivalent in power and generality to a menu item. Indeed, you can construe a button as being a self‑contained, single‑item menu. Since buttons are normally always visible, they offer more immediacy and convenience than menu items at the cost of taking up more space. Because they do take up more space, you will probably want to use them sparingly.
Because of how they are used in everyday life, buttons in a GUI are associated with invocations, actions, and major state changes, not with minor state changes such as setting a single value. Using them in a way that runs counter to this expectation can make your applications harder and less satisfying for people to use.
AppBuilder supplies a default, undefined button object as well as a number of buttons preconfigured for common applications:
*View page — Applies only to ADM paging (see the “Simple SmartContainers” section). Causes objects associated with a certain page number to appear. You supply the number as an argument to the call in the trigger code. Already‑visible objects assigned to other ADM pages do not disappear.
*OK, Cancel — Accepts/discards changes and closes the parent dialog box or window.
*Done — Calls the application’s shutdown routine.
*Help — Calls the help system.
*First, Prev, Next, Last — Moves the current‑record cursor to the record indicated by the button.
*Custom Size/Color — (Default) Creates a generic button with no action defined on it. You must add the action code yourself in the CHOOSE trigger.
Creating a button instance
Because they are such simple objects, you can create and configure buttons very easily.
To create and configure a button in your application:
1. Right‑click the Button in the Object Palette. Choose the appropriate type of button from the context menu:
Note: If you prefer to use the default (undefined) button, simply left‑click on the icon instead; no menu will open.
2. Move your mouse cursor over a bare spot in your workspace window and click to place the new button.
3. Configure, position, and size it appropriately.
Configuring a button instance
To configure a button, you must:
*Customize the appearance to present appropriate cues to the user.
*Write trigger code to respond to the CHOOSE event.
To begin customizing the button’s appearance, select it and choose ToolsProperty Sheet. The Property Sheet dialog box appears:
Minimum configuration
While you can accept many default settings, at a minimum you should do the following:
*Change the object identifier to one that more closely represents the role of this button in your application.
*Set the identifying label to a string or icon that will be meaningful to the user. See the “Setting a button label” section for instructions.
*Resize the button to fit it to its surroundings in a way that minimizes the space it takes up. For the best visual effect, you should make all related buttons the same size, and align them carefully. If one of them is more significant than the others, you can indicate that greater significance by making that button unmistakably larger in one dimension, as in these examples:
For more information on all the settings on the property sheet, see the online help.
Advanced properties
The button object has only the standard advanced properties. See the “Advanced properties” section for further information.
Setting a button label
You can choose to label your buttons with text or an iconic image, but you cannot use both on the same object.
To use a text label, simply type the new string into the Label field. You can even do this without opening the property sheet, if you wish. For your convenience, AppBuilder displays below the toolbar in its main window both the identifier and the label of a button object whenever it is selected.
To use an icon (and override any text label):
1. Double‑click on the square button marked Up. The Choose Image dialog box appears:
2. If the image file you wish to use is listed, select it and click OK. If the Preview check box is on, the image you select will display in the open area to the right of the listing.
If you are looking for a particular type of file (.ico, .bmp, etc.) you can choose to filter for only those files by selecting the appropriate item from the File Type drop‑down list.
3. If the image file is not listed, you can click Browse to look for them. If you will often search certain other directories for image files, you can add the other directories to the drop‑down list in the Directories combo box. Click Edit Path to add a directory, or to modify the order in which they are listed.