Progress
Programming
Handbook
Button Images
In a graphical interface, you can specify one, two, or three images to be displayed in a button. The primary image for a button is called the up image. It is displayed when the button is in the up or unpressed state. You can also specify a down image to be displayed when the button is in the down or pressed state. Progress displays the down image only momentarily when you press the button. Typically, the down image is similar to the up image but with a different color or shading. If you specify an up image but not a down image, Progress continues to display the up image when you press the button. Finally, you can specify an insensitive image to be displayed in place of the up image when the button is disabled.
NOTE: In a graphical interface the label is ignored and the image is used instead. In a character interface, the image is ignored and the label is used. Specifying both a label and an image makes your code portable between graphical and character interfaces.For a button, you can use any image that is supported for the image widget. See the section "Images" later in this chapter.
NO–FOCUS Option
In addition to the types of images that a button can display, you can specify an attribute to indicate that a button with an image will not accept focus. The purpose of providing the NO–FOCUS attribute is to simulate in Progress the standard Windows toolbar button behavior; it is supported on Windows only. Therefore, a button for which the NO–FOCUS attribute is defined will not take focus when the mouse is clicked on it, and it will not accept keyboard input. Also, Progress will not generate ENTRY or LEAVE events for the button.
The status of the NO–FOCUS option of a button is a factor in determining the thickness of a button’s border when no button size is defined. See the section "Specifying Button Size" later in this chapter.
For more information on the NO–FOCUS attribute, see the DEFINE BUTTON Statement reference entry and the NO–FOCUS Attribute reference entry in the Progress Language Reference .
Pre-defined Built-in Button Images
Frequently, you want to use an arrow as an image on a button. Therefore, Progress provides the following predefined built-in button images:
The
p-arrows.p
procedure allows you to scroll forward and backward through the customer records until you choose the QUIT button. The example enables three buttons and uses built-in images for two of them:
When you run this procedure in a graphical environment, arrow images appear on next–but and prev–but. In a character environment, the labels NEXT and PREV appear instead. The SIZE–CHARS option on next–but and prev–but ensure that they are the same size as quit–but.
![]()
Specifying Button Size
When you assign an image to a button, you can specify two sizes: the size of the button and the size of the image. To size the image, use the IMAGE–SIZE, IMAGE–SIZE–CHARS, or IMAGE–SIZE–PIXELS option of the Image phrase. See the section "Images" later in this chapter.
To size the button, you can specify the outside dimensions of the button widget using the size–phrase. If no size is specified, Progress calculates a default size for the button. This calculation adds the button’s border thickness (that is, the combination of 3–D shadows and highlights, and the focus rectangle) to the up image size defined by the IMAGE | IMAGE–UP image–phrase option. However, the thickness of the border depends on whether the button has dual images (up and down images) and whether it is a NO–FOCUS button. For detailed information on how button image and the NO–FOCUS status of a button determine the button’s border thickness, see the section on the DEFINE BUTTON statement in the Progress Language Reference .
You can also change the images for a button at run time by using the LOAD–IMAGE–UP, LOAD–IMAGE–DOWN, and LOAD–IMAGE–INSENSITIVE methods.
The following code example lets you enter the name of an image file. When you enter a name and press GO, the contents of the image file are loaded as the up image for the button. If you do not enter the image file extension, Progress will only search for .bmp or .ico files. You must include the file extension if you wish to use a different type of image file:
If you run this example on Windows and load the Progress
adeicon\next.bmp
file, the following screen appears:
NOTE: Theadeicon\next.bmp
file resides in the Progress distribution in the librarygui\adeicon.pl
. For more information on unloading files from libraries, see the preface.The size of the button changes depending on the size of the image you load. If the image is very large, the button might not fit in the frame. When this happens, Progress displays a warning message.
Preserving Original Color Specifications for Button Images
In a graphical interface such as Windows, you can specify colors for the various areas of a button. To ensure that colors associated with the button’s images (that is, up, down, and insensitive) are not converted to the system 3–D colors, you can use the NO–CONVERT–3D–COLORS option. By default, Progress converts shades of grey in an image to the corresponding system 3–D color. Using this option allows you to override the default behavior to preserve your original color selections for the image on a button.
For detailed information on color conversions for 3–D colors, see the DEFINE BUTTON Statement reference entry in the Progress Language Reference .
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |