Button style attributes

Button presentation style attributes apply to BUTTON elements.

Note: This topic lists presentation style attributes for a specific class of form element, common presentation style attributes can also be used for this type of element.
Table 1. Button style attributes
Attribute GDC GBC GMA GMI
alignment

Defines the position of the image and/or text inside a button, when the button is bigger than the content.

The value can be a combination of a vertical and horizontal alignment hints, separated by a space.

The value can also be "center", which is equivalent to "verticalCenter horizontalCenter".

Vertical alignment hints:
  • "top": anchor to the top edge.
  • "verticalCenter": center in middle.
  • "bottom": anchor to the bottom edge.
Horizontal alignment hints:
  • "left": anchor to the left edge.
  • "horizontalCenter": center in middle.
  • "right": anchor to the right edge.

The default is "center".

Important: With the GDC front-end, the alignment style attribute is not supported for BUTTON elements. However, the content is centered, if there is only a text or image to be displayed. When both text and image are present, these are left aligned and vertically centered.
No (see note) Yes Yes No
buttonType

Defines the rendering of a button.

Values can be:
  • "normal" (default): The button is rendered as a regular push button.
  • "link": the button is rendered as an HTML hyper-link. In contrast to the label hyper-link support, clicking on a "link" button does not start the default browser, but triggers the corresponding action, like a normal button.
  • "commandLink": the button is rendered as a "Command Link" button on Microsoft™ Windows® Vista and Windows 7.
Important: The buttonType Button style attribute cannot be changed dynamically, once the widget has been displayed.
Yes Yes No No

scaleIcon

Defines the scaling behaviors of the associated icon, if the source image size is bigger than the place reserved for it in the widget.

Note: On GDC and GBC, if the scaleIcon attribute is undefined, the behavior depends on the type of action view: toolbar button icons and action panel button icons are scaled down to match the size of the widget. For other widgets, by default no scaling occurs, as for scaleIcon="no".
Values can be:
  • "no": No scaling occurs and the image is taken as-is. It is up to the developer to resize the source image to avoid misalignment. This is the default on GDC/GBC.
  • "yes": Images are scaled down following the height of the widget (button or edit field). Setting a big font can result in a big icon. This is the default on GMA/GMI.
  • "nnnpx": Images are scaled down based on the specified size. For example, scaleIcon="128px" will make every icon a maximum of 128*128 pixels. At least one side equal to 128 pixels, depending if the source image is square or not.

Independently of the style value, the source image is never upscaled to avoid pixelization or blurring of the image. The exception is for SVG images, which can be upscaled without any penalty. If the icon must be enlarged, the image is centered and a transparent border is added to "fill" the empty space. This allows a mix of larger and smaller icons while keeping widget alignment.

If scaling takes place, the aspect ratio of the original image is kept. A non-square source image displays as a non-square scaled icon.

Yes (see note) Yes (see note) No No