ucmdbutton
The ucmdbutton
widget is a button that the user can click to initiate an action. It is a field-level widget that is only applicable to form components.
For more information, see Specifying a Widget for a Field or Entityand Defining Command Buttons.
Default Logical Widgets
Uniface provides the following logical widgets mapped to ucmdbutton
:
- CommandButton—the default logical widget for
ucmdbutton
. - HeaderButton—logical widget for styling a button to look like a column header.
- UnifaceButton—logical widget for the classic command button. Its Representation property is set to
Uniface
, enabling greater control over the appearance of the button.
Widget Properties
Technical Property Name |
UI Property Name |
Default Value |
Dynamic? |
---|---|---|---|
General | |||
Role |
Yes |
||
Representation |
No |
||
Halign |
Yes |
||
Valign |
Yes |
||
Vposition |
No |
||
Vsize |
No |
||
Hscale |
Yes |
||
Vscale |
Yes |
||
PreserveAspect |
Yes |
||
AutoLabel |
Yes |
||
Attach |
Yes |
||
SwitchPalette |
Yes |
||
Transparency |
Yes |
||
ActOnEachClick |
No |
||
ToolTip |
Yes |
||
ToolTipText |
Yes |
||
Cursor |
Yes |
||
Font |
Yes |
||
LabelFont |
Yes |
||
ImageLabelAlign |
No |
||
ImgSize |
Label Image Size ( Image Size (ImgSize))1 |
No |
|
Decoration |
Decoration (CHUI only) |
No |
|
AttachMargin |
Yes |
||
PopupRect |
Yes |
||
Padding |
Yes |
||
Colors | |||
BackColor |
Yes |
||
ForeColor |
Yes |
||
BackColorSelect |
Yes |
||
ForeColorSelect |
Yes |
||
BackColorHover |
Yes |
||
ForeColorHover |
Yes |
||
BackColorFocus |
Yes |
||
ForeColorFocus |
Yes |
||
BackColorFill |
Yes |
||
Images |
|||
ImgDefault |
Yes |
||
ImgSelect |
Yes |
||
ImgHover |
Yes |
||
ImgFocus |
Yes |
||
Frames |
|||
FrameType |
Yes |
||
FrameWidth |
Yes |
||
FrameColor |
Yes |
||
1 Applicable only if Representation is set to |
Triggers
- trigger detail —defines the action that is performed when the user clicks (or otherwise activates) the button. See Activating the Detail Trigger.
Grid and MSAA Support
Supported in Grid? | Yes. Some properties may not be
applicable. For more information, see egrid (Grid) and Widgets and Properties Supported in Grid Widget. |
Supports MSAA? | Yes, for testing purposes only. For more information, see Accessibility. |
Description
The ucmdbutton
is usually a static or control field (as defined by the field's Is Static and Is
Control properties) that enables the user to initiate the action defined in the field's Detail trigger.
By default, it follows the Windows look and feel, but changing the value of the Representation property to a value other than Windows
changes the appearance.
Normally, the field value is used to provide the text to appear on a button, but you can display an image instead of, or
in addition to, text if you set Representation to Uniface
. However, images are not supported
on command buttons in the grid widget.
You can disable ucmdbutton
using the DIM
syntax definition. The text of a disabled button appear dimmed.
Effect of Representation Property
When the Representation
property is set to Uniface
, you have greater control over the appearance of
the button. For example, you can:
- Control the alignment of the button text and image.
- Set background and foreground colors for the button, and change the color of the button text depending on the state.
- Display an image in the button, either with or without text.
- Completely replace the representation of the button with an image, and use different images depending on the button state.
Activating the Detail Trigger
Enter ProcScript in the field's Detail trigger to program the action associated with the button. The following actions activate the Detail trigger for a button:
- Clicking the button
- Pressing the button's access key, if defined
- Pressing a key that is recognized as the default or cancel key, while the button has focus. For more information, see Role.
The keypadenteraccess switch in the [upi] section of the .ini file, controls whether the keypad Enter key activates the default button.
Character Mode
In character mode, the button is implemented as a non-editable, one-line Unifield. The one-character height is used even if it has been drawn as more than one line high. If the field does not contain data, the widget shows the characters defined for the VIEW_PUSH_NULL device translation table mnemonic.
In character mode, only the Decoration property is applicable.
For more information, see Unifields.