Class | Package: cg | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version

## static-picture

### Class

The class of a static-picture control.

### Control

An instance of the :static-picture class. This control displays an icon which may not be changed by the user. It can act like a button; it may be set to receive mouse clicks via the on-click event handler.

The image that is to appear on a static-picture (or on a `picture-button`) widget may be specified with any one of the following properties (typically by passing the equivalent keyword argument such as :pixmap to make-instance when creating an instance of the widget):

- Specify a pixmap object as the value of the pixmap property.
- Specify an icon handle as the value of the pixmap-icon property.
- Specify the name of a cached pixmap as the value of the pixmap-name property. (A pixmap is cached by calling cache-pixmap.)
- Specify the pathname or path namestring of a .bmp or .ico file as the value of the pixmap-source property. When this option is specified programmatically, the pixmap will be loaded from the file when the widget is created at runtime; but when specified interactively in the inspector for a widget on a form, the pixmap will be loaded at design time and saved with project source code so that at runtime the .bmp or .ico file is not loaded or otherwise needed. This is most often the useful option when interactively building forms.

### Mapping application values to multiple pixmaps

The pixmap-alist property of a `static-picture` may be set to an association list that maps arbitrary application values to pixmaps that represent them. Then whenever the value property of the widget is set to one of those application values, the associated pixmap will be displayed. And if the widget's user-modifiable property is true, then the user will be able to cycle through the pixmaps by clicking the widget or pressing the spacebar when the widget has the keyboard focus; selecting a new pixmap will set the value property of the widget to be the associated application value. See pixmap-alist for the format of the association list.

### Further notes

Resizing a static-picture may mean that an aliasing (jaggies) problem appears in the pixmap. Go back to the program that created the graphic and re-save it at a higher resolution or a larger image size if you encounter this problem.

### Customizing the static-picture control

The stretching property: if the :stretching option is passed as non-nil, then the bitmapped image will stretch automatically to fit the size of the widget. If nil, it will be drawn at the size at which the image was defined.

See About how to get sample code for creating controls in cgide.htm, which explains how to use the IDE to create such code.

A diagram of window and widget classes is shown in Widget and window classes in cgide.htm.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.2 page.
Created 2012.5.30.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Unrevised from 8.2 to 9.0. 8.2 version