Text

For Menus and controls that display text and DatePicker controls

Applies to

Menus and controls that display text and DatePicker controls

Description

The Text property specifies the text displayed in the menu object or control.

For menus, if a Menu item has a shortcut key (for example, F1 or Alt+a), Text includes the shortcut key. If the Text property of a Menu item is a single dash (-), the item displays as a separator (a horizontal line the width of the menu), and all other properties for the item are ignored.

In DatePicker controls, the Text property is a read-only property that is equivalent to the Value property with the specified Format or CustomFormat applied. The Text property set for a DatePicker control must be capable of being converted to a DateTime value. This property cannot be set in the painter.

Usage

In a painter

To specify text to be displayed in a Menu item or control:

  • Enter the desired text in the Text field on the General page of the object's Properties view.

In scripts

The Text property takes a string value. The following line specifies that the text of a check box is Male:

cb_1.Text = "Male"

The following statements set the Format property to allow a custom format, then set the custom format, then return the text of the DatePicker control to the string variable ls_text:

string ls_text
dp_1.Format = dtfCustom!
dp_1.CustomFormat = "MMMM dd, yyyy"
ls_text = dp_1.text

For Ribbon controls

Applies to

Ribbon controls (including RibbonApplicationButtonItem, RibbonTabButtonItem, RibbonCategoryItem, RibbonPanelItem, RibbonLargeButtonItem, RibbonSmallButtonItem, RibbonCheckBoxItem, RibbonComboBoxItem, and RibbonMenuItem)

Description

The Text property specifies the text displayed in the menu object or control.

For RibbonMenuItem, the user can assign an accelerator key by typing an ampersand (&) before the letter in the menu item text. For example, &File designates the F in File as an accelerator key. If you specify the accelerator key in the XML file, use the escape character "&" to replace "&". The user can also assign shortcut keys to ribbon menus, see Shortcut for details.

For RibbonTabButtonItem, the text will be shown when the PictureName property for RibbonTabButtonItem is not set.

For RibbonComboBoxItem, the text will be shown in the text box of the ComboBox when the AllowEdit property for RibbonComboBoxItem is set to true.

Usage

In scripts

The Text property takes a string value. The following line specifies &Open as the menu text with the O underlined as the accelerator key:

RibbonMenuItem lnv_menuItem
lnv_menuItem.Text ="&Open"

In the XML file

You can also specify the accelerator key in the XML file. Note that you must use the escape character "&" instead of "&".

<ApplicationMenu>
 <Master>
   <Item Text="Help" Enabled="true"  Visible="true" PictureName="HelpBig!" Checked="false" Type="0">
     <Item Text="&amp;About" Enabled="true" Tag="About" Visible="true" PictureName="AboutBig!" Checked="false" Type="0" Clicked="ue_about" Shortcut="ctrl+alt+a"/>
   </Item>
   <Item Text="&amp;Exit" Enabled="true" Tag="Exit" Visible="true" PictureName="SignOutBig!" Checked="false" Type="0" Clicked="ue_exit"/>
 </Master>        
</ApplicationMenu>