tooltip font [SOLVED]

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
fezztah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jun 20, 2007 14:50

tooltip font [SOLVED]

Postby fezztah » Mon Sep 22, 2008 17:45

I'd like to set the tool tip font, but I can't see how that would be done. The problem is some of the tool tips are quite long - a good sentence or so and the font they are using is too big.

You can set the main font of buttons, etc as a widget property in the layout, but I don't think there is a property for tooltip font?

Perhaps there is a way to specify a default value in the looknfeel for the TaharezLook/Tooltip ?
Last edited by fezztah on Tue Sep 23, 2008 16:22, edited 1 time in total.

User avatar
Kevin
Not too shy to talk
Not too shy to talk
Posts: 29
Joined: Mon May 26, 2008 15:44

Postby Kevin » Mon Sep 22, 2008 20:52

Hello,

It seems that Tooltip inherits from Window, and as such, it has all the same Font functionality as all other windows. Specifically, it has both setFont(Font* font) and setFont(const String& name) functions.

You will also notice (on this page) that there is a Font property for Tooltips (in both WindowsLook and TaharezLook).

Hope that helps.
Kevin

User avatar
fezztah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jun 20, 2007 14:50

Postby fezztah » Tue Sep 23, 2008 09:11

But that would require you to access it at run time and the tooltips are only created "as needed" by the system so how would you do that? Normally to set a font you go:

getWindow("my win name")->setFont("blah")

but you can't do that with a tooltip can you? It doesn't have a name?

The tooltip is only mentioned in the looknfeel file, I don't think you can set a font in that can you? Normally fonts are set in the layout, but tooltips never appear in a layout file.


I suppose I could create a completely new tooltip class that I use instead of the default one that just sets the font to be something else?

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Tue Sep 23, 2008 09:56

A window always has a default tooltip object at least. However it just isn't always visible.

So you can do this:

Code: Select all

getWindow("my win name")->getTooltip()->setFont("blah")


You might add some Null checks just to be sure...

HTH.
Check out my released snake game using Cegui!

User avatar
fezztah
Just popping in
Just popping in
Posts: 20
Joined: Wed Jun 20, 2007 14:50

Postby fezztah » Tue Sep 23, 2008 10:01

Ah, of course. Unless you use custom tooltips then every widget is using the same default tooltip object. So if I grab the first button I see as the app starts and set the font there then it's changed on every menu screen in the entire app.

thanks...

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Wed Sep 24, 2008 19:17

fezztah wrote:Ah, of course. Unless you use custom tooltips then every widget is using the same default tooltip object. So if I grab the first button I see as the app starts and set the font there then it's changed on every menu screen in the entire app.

thanks...


Wouldn't it just be easier to do this during initialization:

Code: Select all

CEGUI::System::getSingleton().getDefaultTooltip()->setFont(...);

User avatar
scriptkid
Home away from home
Home away from home
Posts: 1178
Joined: Wed Jan 12, 2005 12:06
Location: The Hague, The Netherlands
Contact:

Postby scriptkid » Wed Sep 24, 2008 19:43

Jamarr wrote:Wouldn't it just be easier to do this during initialization:

Code: Select all

CEGUI::System::getSingleton().getDefaultTooltip()->setFont(...);


<bows>

:)
Check out my released snake game using Cegui!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests