Page 1 of 1

[SOLVED] tooltip on comboboxes and tabcontrols

Posted: Fri Dec 05, 2008 08:21
by sjcomp
Hello,

I have tooltips displaying properly for all elements other than comboboxes and tab control buttons. What might be the cause of it? I'm using cegui 0.5.1.

Thanks.

Posted: Fri Dec 05, 2008 10:08
by CrazyEddie
Hi,

I guess you're setting the tooltip text on the base container for the combobox and tabcontrol (as well you might expect to), the issue is that the system thinks the mouse is over different windows (the component parts of the combobox and tabcontrol). There is a mechanism whereby children can inherit the parent tooltip text (which is what you need), though this is disabled on all widgets by default - it should really be enabled by default (as is the case in SVN trunk IIRC - I'm not suggesting you start using that btw ;) ).

One solution would be to edit your looknfeel skin file and add a property initialiser to each WidgetLook definition to enable this setting:

Code: Select all

<Property name="InheritsTooltipText" value="True" />


Bit of a pain, though it should get you what you want.

CE.

Posted: Sat Dec 06, 2008 17:13
by sjcomp
Thanks, CE. An easy solution actually :) It works perfectly for comboboxes. But I see that I have a different issue with TabControl. I'd like to assign hints to TabControl buttons, but I have no access to them through my layout. I did assign hints to the tab panes (DefaultWindow), but it simply shows hint when I hover over the window itself. My question is: can I assign hints to tabcontrol buttons through the layout?

I can take care of it through my program and reassign hints from the tab pane to the corresponding button. But maybe there is a more elegant solution (like a few copy/paste operations)? :)

Thanks.

Posted: Sat Dec 06, 2008 18:18
by CrazyEddie
Providing you add your tab content directly as child elements of the TabControl - meaning the TabControl definition and it's content are in the same layout - it's possible to set the tooltips. Basically you use the auto-window mechanism to set the Tooltip property on the automatically created button. The key is that the AutoWindow element must appear after the Window definitions for the tab pane content.

The tab pane buttons are named as: __auto_TabPane__Buttons__auto_btn<content name>, so if your content window was named "APane", the button for it is called "__auto_TabPane__Buttons__auto_btnAPane"

So, for example:

Code: Select all

        <Window Type="TaharezLook/TabControl" Name="myTabControl" >
            <Property Name="Tooltip" Value="This is the tab control" />
            <Property Name="TabHeight" Value="{0,-1}" />
            <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
            <Property Name="TabPanePosition" Value="Bottom" />
            <Property Name="UnifiedAreaRect" Value="{{0,10},{0,30},{1,-10},{1,-10}}" />

            <Window Type="DefaultWindow" Name="myTabControl/APane" >
                <Property Name="Text" Value="A Pane" />
            </Window>

            <!-- Set the tooltip for the tab button -->
            <AutoWindow NameSuffix="__auto_TabPane__Buttons__auto_btnAPane" >
                <Property Name="Tooltip" Value="This is a pain!" />
            </AutoWindow>

        </Window>


HTH

CE

Posted: Sat Dec 06, 2008 22:45
by sjcomp
Thanks, CE. It does work! It's a pity that CELayoutEditor removes them when I save the document. Is there a way to configure the editor?

Thanks a lot for very quick help!

Posted: Sun Dec 07, 2008 10:39
by CrazyEddie
Hi,

IIRC there have been other posts with regards to manually added content being removed in the editor, although those dealt with 'normal' properties that are just not supported by the editor and get removed. I've not looked at this specific case, though it's probably a CEGUI issue, since CEGUI is actually writing the XML.

So no, I do not think there's a (simple) way to get this support at the moment, unfortunately. (Unless someone else knows different, of course :) ).

CE.