3.8 check-box%
Implements: control<%>
A check box is a labeled box which is either checked or unchecked.
Whenever a check box is clicked by the user, the check box's value is toggled and its callback procedure is invoked. A callback procedure is provided as an initialization argument when each check box is created.
(->newcheck-box% (label_) (parent_) [(callback_)] [(style_)] [(value_)] [(font_)] [(enabled_)] [(vert-margin_)] [(horiz-margin_)] [(min-width_)] [(min-height_)] [(stretchable-width_)] [(stretchable-height_)])check-box%object
label: string (up to 200 characters) orbitmap%object
parent:frame%,dialog%,panel%, orpane%object
callback=: procedure of two arguments: a(lambda(ce) (void))check-box%object and acontrol-event%object
style=null: list of symbols in'(deleted)
value=#f: boolean
font=:normal-control-fontfont%object
enabled=#t: boolean
vert-margin=2: exact integer in [0, 1000]
horiz-margin=2: exact integer in [0, 1000]
min-width=0: exact integer in [0, 10000]
min-height=0: exact integer in [0, 10000]
stretchable-width=#f: boolean
stretchable-height=#f: booleanCreates a check box with a string or bitmap label. If
labelis a bitmap, then the bitmap must be valid (seeok?inbitmap%) and not installed in abitmap-dc%object; otherwise, anexn:fail:contractexception is raised. If the bitmap has a mask (seeget-loaded-maskinbitmap%) that is the same size as the bitmap, then the mask is used for the label; furthermore, in contrast to the limitations ofdraw-bitmapindc<%>, non-monochrome label masks work consistently on all platforms.If an ampersand (``&'') occurs in
label(whenlabelis a string), it is specially parsed; under Windows and X, the character following an ampersand is underlined in the displayed control to indicate a keyboard mnemonic. (Under Mac OS X, mnemonic underlines are not shown.) The underlined mnemonic character must be a letter or a digit. The user can effectively click the check box by typing the mnemonic when the control's top-level-window contains the keyboard focus. The user must also hold down the Meta or Alt key if the keyboard focus is currently in a control that handles normal alphanumeric input. The ampersand itself is removed fromlabelbefore it is displayed for the control; a double-ampersand inlabelis converted to a single ampersand (with no mnemonic underlining). Under Mac OS X, a parenthesized mnemonic character is removed (along with any surrounding space) before the label is displayed, since a parenthesized mnemonic is often used for non-Roman languages. Finally, any text after a tab character is removed on all platforms. Mnemonic keyboard events are handled byon-traverse-char(but not under Mac OS X).The
callbackprocedure is called (with the event type'check) whenever the user clicks the check box.If
styleincludes'deleted, then the check box is created as hidden, and it does not affect its parent's geometry; the check box can be made active later by callingparent'sadd-childmethod.If
valueis true, it is passed toset-valueso that the box is initially checked.The
fontargument determines the font for the control. For information about theenabledargument, seewindow<%>. For information about thehoriz-marginandvert-marginarguments, seesubarea<%>. For information about themin-width,min-height,stretchable-width, andstretchable-heightarguments, seearea<%>.
Methods
get-value
set-label
set-value
All Methods
accept-drop-files from window<%>
client->screen from window<%>
command from control<%>
enable from window<%>
focus from window<%>
get-client-size from window<%>
get-cursor from window<%>
get-font from control<%>
get-graphical-min-size from area<%>
get-handle from window<%>
get-height from window<%>
get-label from window<%>
get-parent from area<%>
get-plain-label from window<%>
get-size from window<%>
get-top-level-window from area<%>
get-value from check-box%
get-width from window<%>
get-x from window<%>
get-y from window<%>
has-focus? from window<%>
horiz-margin from subarea<%>
is-enabled? from window<%>
is-shown? from window<%>
min-height from area<%>
min-width from area<%>
on-drop-file from window<%>
on-focus from window<%>
on-move from window<%>
on-size from window<%>
on-subwindow-char from window<%>
on-subwindow-event from window<%>
on-superwindow-enable from window<%>
on-superwindow-show from window<%>
popup-menu from window<%>
refresh from window<%>
screen->client from window<%>
set-cursor from window<%>
set-label from check-box%
overrides set-label from window<%>
set-value from check-box%
show from window<%>
stretchable-height from area<%>
stretchable-width from area<%>
vert-margin from subarea<%>