Delphi's TTreView control displays a hierarchical list of items, such as files and directories on a disk.
By Windows design, when you hover your mouse over an item, a hint (tooltip) window appears containing the title of the item under the mouse cursor, if the entire title is not currently visible.
NOTE: this feature is *not related* to the standard Delphi's Hint and ShowHint properties exposed by every Delphi control.
The ShowHint property determines whether the control displays a hint when the mouse pointer rests momentarily on the control. The hint displayed is stored in the controls Hint property.
Remove Default Tree Item's Tooltip
Even if the ShowHint property is false, when the mouse is over a tree item (TTreeNode), a tooltip will be displayed containing the title of the item under the mouse cursor, if the entire title is not currently visible.
Sometimes, you might want to disable such tree view behavior in order to show, for example, custom hints for every tree node.
The next line of code disables the automatic tool tip feature of the TTreeView control (named "treeView1").
//no auto tool tip for treeView1
SetWindowLong(treeView1.Handle, GWL_STYLE, GetWindowLong(treeView1.Handle, GWL_STYLE) or TVS_NOTOOLTIPS);
An ideal location for this code is inside the Form's OnCreate event handler (for the form hosting the treeView1 control).
Note: the initial tree view styles are set in the constructor.
No comments:
Post a Comment