wStyle Property (ToolBar and MenuBar Controls)

Applies to TestComplete 15.0, last modified on October 14, 2021

Description

Returns the button’s styles.

Declaration

TestObj.wStyle(Item, By Position)

Read-Only Property Integer
TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Item [in]    Required    Variant    
By Position [in]    Optional    Boolean Default value: False   

Applies To

The property is applied to the following objects:

View Mode

To view this property in the Object Browser panel and in other panels and dialogs, activate the Advanced view mode.

Parameters

The property has the following parameters:

Item

Specifies the caption, identifier or position on the control (from 0) of the desired item. For more information, see the Remarks section at the bottom of this page.

By Position

Specifies whether the Item parameter specifies the identifier or position on the control of the desired item. For information on which of these values is used, see the Remarks section below.

Property Value

An integer value indicating the styles that are applied to the specified button. A control button can have a combination of applied styles. Here are some of the button styles:

Value Constant Description
0 BTNS_BUTTON, TBSTYLE_BUTTON A standard button.
1 BTNS_SEP, TBSTYLE_SEP A separator, providing a small gap between button groups.
2 BTNS_CHECK, TBSTYLE_CHECK A dual-state push button that toggles between the pressed and un-pressed states each time the user clicks it.
4 BTNS_GROUP, TBSTYLE_GROUP When combined with BTNS_CHECK, a button stays pressed until another button in the group is pressed.
8 BTNS_DROPDOWN, TBSTYLE_DROPDOWN A button with an attached down arrow, which displays a list when the arrow is clicked.
10 BTNS_AUTOSIZE, TBSTYLE_AUTOSIZE When this style is applied, the button’s width is calculated based on the width of the text plus the image of the button.
20 BTNS_NOPREFIX, TBSTYLE_NOPREFIX Button text does not have an accelerator prefix associated with it.
40 BTNS_SHOWTEXT When this style is applied, button text is displayed. All buttons can have text, but only those buttons with the BTNS_SHOWTEXT button style display it.
80 BTNS_WHOLEDROPDOWN A button that displays a drop-down list when clicked.

A complete list of the available styles and style constants is given in the Toolbar Control and Button Styles topic of the MSDN library.

Remarks

You can specify the desired control’s item by assigning item’s caption, identifier or position on the control to the Item parameter. Therefore, if this parameter holds a string, TestComplete identifies the item by caption. When Item specifies the caption, you can use wildcards (* and ?) or regular expressions to mark variable parts of the caption. The caption can be case-sensitive or case-insensitive depending on the value of the Use case-sensitive parameters project setting. If Item holds an integer value, then TestComplete checks the ByPosition parameter to determine in what way to identify the item: if ByPosition is True, TestComplete treats the Item value as the item position; if ByPosition is False, TestComplete treats the Item value as an identifier.

If you use Python or DelphiScript, you should enclose the parameters of the wStyle property in square brackets: wStyle[Item, ByPosition].

See Also

wChecked Property
wEllipses Property
wEnabled Property
wGrayed Property
wButtonPos Property
wButtonID Property
wButtonText Property

Highlight search results