ClassPackage: cgToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version

button

Class

The class of a standard button control having the title attribute displayed on the face of the button. Subclasses include default-button and cancel-button.

Control

Instance of the button class. This is a standard button control displaying text. The on-change function begins any action initiated by the button being clicked.

Adding a button control to your form

Click the button tool on the Component toolbar. Move the mouse cursor to the part of the form where you want to place the control, and click again. The control will appear with colored resizing handles.

Resizing and moving the control

Controls can only be resized and moved on forms during the design stage; the size and location of everything is fixed on a running form.

Resize the control by clicking the mouse cursor and dragging one of the handles to the new size-point. Release the mouse key when you are satisfied with the new size.

Move the control by clicking anywhere on it except a resizing handle and dragging it to a new location on the form. Release the mouse key when you are ready to place the control.

Notes

The displayed name of the button is the value of the title property. If the wrapping property is true, the title will wrap text to a second line if necessary. If wrapping is nil, text that does not fit will not be displayed.

This button doesn't stay pressed in when clicked. It gives a little jump and then returns to its resting state.

The background color is inherited from Windows. Use a picture-button if you want more control over the appearance.

Creating an instance of a button control

This call to make-instance returns an instance of button. Properties and event-handlers can be initialization keyword arguments (the keyword has the same name as the property, with a prepended colon, e.g. :width for width). Additional arguments could be provided. Their absence indicates the default value will be used.

(make-instance 'button
               :font
                 (make-font-ex nil "MS Sans Serif" 11 nil)
               :left 263
               :name :button4
               :on-click 'form1-button4-on-click
               :title "Here"
               :top 160
               :width 33))

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-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version