{<name>:} button {<string>}
Push-button sub-panel, text or image.
Panel window
Tab window
Table window
Menupane
<name>
A name to be given to the sub-panel for reference purposes.
<string>
The text shown within the button. This can be omitted when the button is shown in image
form.
-bc=<color>
The background color for the button. When the button is an image button, a
value of no_change will use the color of the button's
parent window. This is applicable to monochrome image files only.
This may be used to indicate a change of background color when the button merely displays text.
-bor=<n>
The button shadow thickness.
A value of 0 will give the button the appearance of a label but with button
interaction.
On Unix systems a positive value of n will set the shadow
thickness.
On Windows systems, a positive value will give the button the
system default shadow thickness. The total size of the button will always include
the button thickness irrespective of the border visibility.
-cam=<num>
Display the numth cameo from a Fire image file (indicated by the
-cr switch).
-cr=<file(s)>
Display a raster image. This can be the name of one image file or more when a
multiple image button is required (see -mul).
Multiple files should be comma-separated all enclosed within <
and >.
-dim=<screen_xy>
Define the dimensions of the button in pixels. This is usually redundant
because buttons are by default created sized-to-fit, but is useful when
the size needs to be overridden. This is a two-element numeric array providing
width and height. If only one is required, the other can be set to -1 and will be ignored.
-fc=<color>
The foreground color for the image. This is applicable to monochrome images
only.
-fo=<font>
The font to be used for button text. This must be a fixed font. If omitted
the button inherits the font of its parent row or column. This is ignored
for image buttons.
-gh
The sub-panel should be initially ghosted, i.e. insensitive to user-interaction.
-h=<num>
The height of the button in pixels. If omitted, the button height will be sized to
fit.
-inv
Make the sub-panel invisible on creation.
-j=<just>
The justification of the button within its parent row or column. Within a parent row the
value should be one of L, M, R. Within a parent column the value should
be one of T, M or B. The default in both cases is M.
-link=<text>
The resize linkage for the panel.
This ties panel edges to one or more edges of the parent
window, with the result that when the parent window gets resized, the
panel gets automatically resized as well. <text>
is a combination of the characters L, R, T, B and M. A value of "LRTB"
means that the left, right, top and bottom edges of a sub-panel are linked
to its parent. The default value is "TL", which links the left
and top edges to the parent window but does no resizing because its right
and bottom edges are not linked. Note that the linkage is to edges of
the parent window, not to column/row extremities. More complicated linkage
requirements should be done via the window.resize
callback on the parent window.
-mul
Indicates that the button image (defined by -cr)
can be any of the cameos from a Fire menu image file. The button image
displayed at a particular time is cameo <n>,
where n is the value of the panel.value element.
Initially cameo 1 is displayed.
-pj=<just>
The position justification of the sub-panel within the panel window. This combined
with the -x and -y switches
can be used to position the sub-panel by one of its corners. The default
is 'TL'. It also defines the control point to be used when repositioning
the sub-panel after creation.
-res=<num>
Used in conjunction with the -cr switch, this defines
a scaling factor for the image. For example, a value of 0.5 will show the image half-size.
-tc=<color>
The color for text in the button (or the image frame color). If omitted
the parent window "other color" is used.
-th=<num>
Draw a frame of width <num>
pixels around the image. The color used is the parent window "other
color". This is ignored for text buttons.
-tt=<string>
A tool tip to appear
when the user rests the mouse cursor over the panel. This feature is available
only in panel windows on Windows systems.
-w=<num>
The width of the button
in pixels. If omitted, the button width will be sized to fit.
-x=<num>
The x position of the button relative to the top-left corner of its parent row
or column. If omitted, the button is placed adjacent to the previously
defined sub-panel.
-y=<num>
The y position of the button relative to the top-left corner of its parent row
or column. If omitted, the button is placed below the previously defined
sub-panel.
<panel>.exec(<window>,<panel>)
Called on button hit using mouse button 1:
Panel/Tab Window
panel.exec { args w=window, p=panel }
Table Window
panel.exec { args w=window, p=panel, row=numeric }
Switches -j, -mul, -pj, -x and -y apply only to buttons within a panel window. Buttons within other windows and menupanes cannot have a user-defined position or justification.
The numeric identifier clicks may be tested within the .exec callback to differentiate between a single or double mouse click on the button.
To use a button to simulate a keyboard interrupt, use the following as its callback:
<panel>.exec = { interrupt }
Create a panel window containing two text buttons.
window w = wpanel { apply: button 'Apply' cancel: button 'Cancel',-tc=red }
Create a panel window containing a text button of defined size and font.
window w = wpanel { app: button 'My Application',-dim=<250,100>,-fo=myfont }
Create a panel window containing two single image buttons, and one multiple image button.
window w = wpanel { m: button -cr='modem.ras' t: button -cr='telephone.ras',-gh ;# Ghosted v: button -cr='series.ras',-mul ;# Multiple image }
Create a panel window containing four image buttons taken from a parent multiple-image file.
window w = wpanel { # Use the window background color for that of the images row -cr='series.ras',-bc=no_change { button -cam=1 button -cam=2 button -cam=3 button -cam=4 } }