Class: cToolTipController

Properties  Events  Methods    Index of Classes

Handles the management and display of a collection of ToolTip strings associated with the various UI controls in your application. e.g. ToolTips for Form, dbForm, Checkbox, or Button objects.

Hierarchy

cObject
---cToolTipController

Library: Windows Application Class Library

Package: cToolTipController.pkg

Description

ToolTips appear automatically when the user hovers the mouse pointer over a UI control (such as a Form object). The ToolTip appears near the pointer and disappears when the user clicks a mouse button, moves the pointer away from the object, or simply waits for a few seconds.

ToolTip controls can display a single line of text or multiple lines. They can have a stem which points to the object like a cartoon speech balloon. The ToolTip can display an icon and a title in addition to the ToolTip text string.

Syntax

Use cToolTipController.pkg

Object oToolTip is a cToolTipController
    Move Self to ghoToolTipController
End_Object


Normally, your application would declare one cToolTipController object situated just below the cApplication object in your project.src file. If you set the global object handle ghoToolTipController, then your application's UI controls will automatically use this ToolTip controller for displaying their ToolTip strings.

A cToolTipController object must be declared before any UI object is declared that will use the ToolTip controller.

Adding the code above should be all you need to do to enable tooltips to legacy (pre-DataFlex 15.0) Windows applications.

Sample

Use cToolTipController.pkg

Object oToolTip is a cToolTipController
    Set pbBalloonStyle to True 
    Set piIcon to TTI_INFO 
    Set psTitle to "Tip"    
    Move Self to ghoToolTipController
End_Object


The above object declares a global ToolTip controller that displays its ToolTips inside a cartoon balloon window. The ToolTips also display a title string ("Tip") and an icon. This would normally be positioned just below the global cApplication object.

Object oName_Frm is a Form
    Set Size to 13 50
    Set Location to 25 70
    Set Label to "Name:"
    Set psToolTip to "Enter a name in the format <lastname>, <firstname>"
End_Object


The above object sets the psToolTip property. This string will be automatically added to the collection of ToolTip strings managed by the cToolTipController object pointed to by ghoToolTipController.

Object oHelpTips is a cToolTipController
    Set pbBalloonStyle to True 
    Set piIcon to TTI_INFO 
    Set psTitle to "Information"    
End_Object

Object oSaveButton is a Button
    Set Location to 25 70
    Set Label to "Save"
    Set phoToolTipController to oHelpTips
    Set psToolTip to "Click to save the configuration"
End_Object


The above code declares a cToolTipController object but does not set it as the global ToolTip controller. The button object sets a psToolTip string and sets its phoToolTipController property to point to oHelpTips. This means that oHelpTips will be used for this button instead of the application's global ToolTip controller object.

You might choose to do this if you want to change the default appearance and behavior of the ToolTip associated with one or more objects.

Activating ToolTips

A cToolTipController object can be either active or inactive. When it is active, the ToolTip text appears when the mouse pointer is on a UI Object. When it is inactive, the ToolTip text does not appear. The pbActive property activates and deactivates a ToolTip control.

Multiline ToolTips

Multiline ToolTips allow text to be displayed on more than one line. To use multiple lines, set piMaxWidth specifying the width of the ToolTip's display rectangle in pixels. Text that exceeds this width wraps to the next line rather than widening the display region.

Balloon ToolTips

Balloon ToolTips are similar to standard ToolTips, but are displayed in a cartoon-style "balloon" with a stem pointing to the UI object. Set pbBalloonStyle to True to display ToolTips in a balloon window.

Tool bar and Tab Page ToolTips

DataFlex tool bar and tab page objects use an internal ToolTip controller. The cToolTipController class has no effect on the behavior and appearance of tool bar and tab page ToolTips.

Appearance on Different Windows Versions

Some of the tool tip appearance attributes, such as images and balloon style, will appear differently under Windows XP and Vista. This is the expected behavior of this Windows control. When setting these properties in your application, you will want to verify the tool tip appearance on all target platforms and skins.

Tooltips are not supported for disabled controls (e.g. Enabled_State = False).