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.

CommandButton widget

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

ucmdbutton Widget Properties

Technical Property Name

UI Property Name

Default Value

Dynamic?

  General

Role

Role

 

Yes

Representation

Representation

 

No

Halign

Horizontal Alignment (Halign)1

 

Yes

Valign

Vertical Alignment (Valign)1

 

Yes

Vposition

Vertical Position

 

No

Vsize

Vertical Button Size

 

No

Hscale

Horizontal Scaling (Hscale)1

 

Yes

Vscale

Vertical Scaling (Vscale)1

 

Yes

PreserveAspect

Preserve Aspect Ratio (PreserveAspect)1

 

Yes

AutoLabel

Auto Label (AutoLabel)

 

Yes

Attach

Attach to Window Border (attach)

 

Yes

SwitchPalette

Switch Palette (SwitchPalette)1

 

Yes

Transparency

Transparency

 

Yes

ActOnEachClick

Act on Each Click

 

No

ToolTip

Tool Tip (ToolTip)1

 

Yes

ToolTipText

Tool Tip Text (ToolTipText)

 

Yes

Cursor

Mouse Pointer (Cursor)

 

Yes

Font

Widget Font (Font)

 

Yes

LabelFont

Label Font (LabelFont)

 

Yes

ImageLabelAlign

Label Image Alignment (ImageLabelAlign)1

 

No

ImgSize

Label Image Size ( Image Size (ImgSize))1

 

No

Decoration

Decoration (CHUI only)

 

No

AttachMargin

Attach Margin (AttachMargin)

 

Yes

PopupRect

Popup Rectangle (PopupRect)

 

Yes

Padding

Padding1

 

Yes

  Colors

BackColor

Background Color (BackColor) 1

 

Yes

ForeColor

Foreground Color (ForeColor)1

 

Yes

BackColorSelect

Active Background Color (BackColorSelect)

 

Yes

ForeColorSelect

Active Foreground Color (ForecolorSelect)1

 

Yes

BackColorHover

Hover Background Color ( BackColorHover)

 

Yes

ForeColorHover

Hover Foreground Color (ForeColorHover)1

 

Yes

BackColorFocus

Focus Background Color (BackColorFocus)

 

Yes

ForeColorFocus

Focus Text Color (ForeColorFocus)1

 

Yes

BackColorFill

Gradient Fill Style (BackColorFill)1

 

Yes

 

Images

ImgDefault

Default Image (ImgDefault)1

 

Yes

ImgSelect

Active Image (ImgSelect)1

 

Yes

ImgHover

Hover Image (ImgHover)1

 

Yes

ImgFocus

Focus Image (ImgFocus)1

 

Yes

 

Frames

FrameType

Frame Type (FrameType)1

 

Yes

FrameWidth

Frame Width (FrameWidth)1

 

Yes

FrameColor

Frame Color (FrameColor)1

 

Yes

1 Applicable only if Representation is set to Uniface.

Triggers

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.

Related Topics