Products
Technologies

Developer resources

How to display toolTip message for each nodes shown in Tree control

Not yet rated.

Problem

The Tree control has 'toolTip' property. But it is applied for Tree control itself, not for each nodes shown in the control. In addition, the control does not have any methods to show toolTip hint as you want. Thus, the property is difficult to show toolTip message for each nodes dynamically.

Solution

Here is the workaround for the above problem: When the 'Tree.itemRollOver' event is fired, you can refer the node which is rolled over by user.Thus, you can get text of the node to show it as toolTip.

Detailed explanation

Please find the attached sample program, the TreeToolTips.zip, which illustrates the workaround.
The sample program works like following.

(1) The sample program loads XML file, data.xml, which contains 'label text' and 'toolTip text' of the nodes.

(2) When program is launched, it shows the label text in the Tree.

(3) When user rolled node over, the 'Tree.itemRollOver' event is fired.
   At this point, the onItemRollOver() get 'toolTip text' via the event.itemRenderer.data property.

(4) The toolTip text is shown in light-blue bar in the application.
 

The Tree control has 'toolTip' property. But it is applied for Tree control itself, not for each nodes shown in the control. In addition, the control does not have any methods to show toolTip hint as you want. Thus, the property is difficult to show toolTip message for each nodes dynamically.

TreeToolTips.zip
[This .zip file contains 2 files, The "TreeToolTips.mxml" and the "data.xml".]
ScreenShot_TreeToolTips.PNG
TreeToolTipsVer2.zip

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes