Skip to main content

How to show Tooltips always in front

1 reply [Last post]
Joined: 2005-07-11
Points: 0

i wrote a class for showing tooltips when the mouse enters a component (lets call it A). i do it by adding a component3d (the tooltip) to A and registering mousedrag and mouseentered events to A. i have 2 problems:
- the mouseentered events seem slow, when the mouse leaves A, the tooltip stays visible for a time
- how to show the tooltip always in front, so its not hidden by A

i tried to solve the second problem by adding the tooltip like this:

<br />
    protected void addTooltip(Component3D comp)<br />
    {<br />
        TransparencyOrderedGroup tog = new TransparencyOrderedGroup();<br />
        Enumeration allChildren = comp.getAllChildren();<br />
        while( allChildren.hasMoreElements() )<br />
        {<br />
            tog.addChild( (Node) allChildren.nextElement() );<br />
        }<br />
        tog.addChild( tooltip );<br />
        comp.removeAllChildren();<br />
        comp.addChild( tog );<br />
    }<br />

is this a good way to do it?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-06-13
Points: 0

What was the result, did it work ?

For testing this should be a good solution, but it won't work in the long run because it does not support the addition of further children to the component3D.

We should add the TransformOrderedGroup, or maybe just OrderedGroup directly to J3dComponent3D and make tooltip support a first class citizen in the API.