Specifies the text that appears as a ToolTip for a control. You can set the ToolTipText property only if the ShowTips property of the form or toolbar that contains the control is set to True (.T.). Read/write at design and run time.
Control.ToolTipText [= cExpr] |
Return Value
- cExpr
- Specifies the text to use for the ToolTip. The maximum number of characters you can specify for cExpr is 4,095.
Remarks
Applies To: CheckBox | Column | ComboBox | CommandButton | CommandGroup | Container | Control | EditBox | Grid | Header | Image | Label | Line | ListBox | OLE Bound Control | OptionButton | OptionGroup | PageFrame | Shape | Spinner | TextBox
Visual FoxPro supports wordwrapping for ToolTips.
When you specify the ToolTipText property for contained controls like a Column, Header, or OptionButton, the ToolTipText property of the innermost object takes precedence if the mouse cursor moves over both objects that specify a ToolTip.
For all contained controls except the Grid control, if the contained object does not specify the ToolTipText property, but the container does, Visual FoxPro does not display a ToolTip when the mouse moves over the contained control.
If the objects contained in a Grid control do not specify the ToolTipText property, but the container does, Visual FoxPro displays the ToolTip for the container. For example, if the mouse moves over a column Header object, and the Header does not specify the ToolTipText property, Visual FoxPro displays the ToolTip of the column.
Visual FoxPro displays controls inside a column, for example, a TextBox control, that specify the ToolTipText property only when the control has focus. If the control does not specify a ToolTip when it has focus, the ToolTip of the column is displayed.
Examples
Example 1
The following code sections illustrate how to display ToolTips for contained controls other than a grid. The following example shows how the ToolTips for the CommandButton control and the CommandGroup control display when each control has focus, for example, when you move the mouse pointer over the command button or command group.
В | Copy Code |
---|---|
CommandGroup1.ToolTipText = "Hi, I'm a CommandGroup." CommandGroup1.Command1.ToolTipText = "Hi, I'm Command 1." CommandGroup1.Command2.ToolTipText = "Hi, I'm Command 2." |
In the following code section, the ToolTip for Command2
does not display when the control has focus because the ToolTip for the control is not specified.
В | Copy Code |
---|---|
CommandGroup1.ToolTipText = "Hi, I'm a CommandGroup." CommandGroup1.Command1.ToolTipText = "Hi, I'm Command 1." |
Example 2
The following code sections illustrate how to display ToolTips for controls contained in a grid. The following example shows how the ToolTip for the TextBox control displays when the control has focus, for example, when you move the mouse pointer over the text box.
В | Copy Code |
---|---|
Grid1.ToolTipText = "Hi, I'm a Grid." Grid1.Column1.ToolTipText = "Hi, I'm a Column." Grid1.Column1.Header1.ToolTipText = "Hi, I'm a Header." Grid1.Column1.Text1.ToolTipText = "Hi! I'm the Textbox!" |
In the following code section, the ToolTip for the TextBox control does not display when the control has focus because the ToolTip for the text box is not specified.
В | Copy Code |
---|---|
Grid1.ToolTipText = "Hi, I'm a Grid." Grid1.Column1.ToolTipText = "Hi, I'm a Column." Grid1.Column1.Header1.ToolTipText = "Hi, I'm a Header." |
In the following code section, the ToolTip for the column appears when the Header control has focus because the ToolTip for the header is not specified.
В | Copy Code |
---|---|
Grid1.ToolTipText = "Hi, I'm a Grid." Grid1.Column1.ToolTipText = "Hi, I'm a Column." |
In the following code section, the ToolTip for the grid appears when the Column or Header control has focus because the ToolTip for the column or header is not specified.
В | Copy Code |
---|---|
Grid1.ToolTipText = "Hi, I'm a Grid." |
See Also
Reference
_TOOLTIPTIMEOUT System VariableOther Resources
ShowTips PropertyProperties
Language Reference