Page 1 of 1

A couple questions about tooltips

Posted: Mon May 13, 2013 09:42
by Jefferian
I've been trying using tooltips in these days. And there are some things i can't understand about how they work. No, not the injectTimePulse.
Because as far as "working" goes, they're working indeed. The problem is, well...
Image
...that is, it gets cut out at the end of the screen. I've seen the demos, and it doesn't happen anything like that there (note that while the look is customized, i used the same exact looknfeel code from taharezlook for them - changing the images, obviously - and i haven't customized anything about how widget work). I supposed it would position itself as to avoid this happening, like in the various demo. What am i doing wrong here, then? Is the text too long - and that would bring to the second question, that is...
Tooltips and multilines. Oh, i've read some old threads. Some from the long past 2008 suggested to use the newline char ( '\n' ) in the text of the tooltip, or putting directly a line in the layout. Well, if i put the newline char, it gets simply printed along with the rest of the text. So i tried linewrapping with the horzformat property in the tooltip looknfeel, but it hadn't done absolutely anything. So...any idea?

Obviously, there aren't any errors or warning in the cegui log files.
Regarding the log, anyway, here is the essential section.

Code: Select all

Version 0.7.9 (Build: Jan 22 2013 Debug Microsoft Windows g++ 4.7.1-dw2 32 bit)
Renderer module is: CEGUI::OgreRenderer - Official OGRE based 2nd generation renderer module.
XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI
Image Codec module is: OgreImageCodec - Integrated ImageCodec using the Ogre engine.
Scripting module is: None

Re: A couple questions about tooltips

Posted: Mon May 13, 2013 11:10
by CrazyEddie
Hi,

If you use a different font, does it position correctly then? (yes, I think it is maybe related to your other issue :)). Also, newlines in tool tip texts should work, I believe.

CE.

Re: A couple questions about tooltips

Posted: Mon May 13, 2013 12:21
by Jefferian
CrazyEddie wrote:Hi,

If you use a different font, does it position correctly then? (yes, I think it is maybe related to your other issue :)). Also, newlines in tool tip texts should work, I believe.

CE.


Ok, now i feel really stupid. Cause by searching the source of this issue (and not finding it) i solved the other one. That is...i had another copy of that font i used in the main menĂ¹ (it doesn't use CEGUI there) in another folder and it was always loaded before - and in place - of the correct spaced ttf font.
That also explains why i didn't see any change when i modified it...it wasn't loaded anyway. I'm quite sorry for having you spend time on such a blunder (gotta copy the "solution" in the other thread now, though).

Regarding this issue, though...changing into Arial didn't solve anything, neither putting '\n' or even trying with '\r\n'. I kinda suspect the cause is related to the looknfeel. Due to this.
Image
It did go to a new line by itself, probably due to having correct spacing and thus getting too large. I'll try modifying the looknfeel.

Re: A couple questions about tooltips

Posted: Mon May 13, 2013 12:42
by CrazyEddie
I think I failed to answer the initial query correctly (read as: failed to read the initial query correctly). To add a line break in a layout file, use the long form for the <Property> tag, so instead of:

Code: Select all

<Property Name="TooltipText" Value="This is a tooltip, I really wish I could put a line break in here!" />

Do:

Code: Select all

<Property Name="TooltipText">This is a tooltip.
It's really cool that we can add line breaks
like this!</Property>

Not sure if you're using the editor, if so this should happen automatically for multi-line texts (since CEGUI writes multiline texts out using the long form.)

HTH

CE.

Re: A couple questions about tooltips

Posted: Mon May 13, 2013 21:06
by Jefferian
Multilines work indeed with the long form for the tag. Didn't know about it. And yep, i use CEED, but i can't see how you can write multilines when modifying properties in the visual editor. I tried putting the newline character there after all, and it didn't result in the long form of the tag - i still had the short form, with the '\n' or '\r\n' where i wrote it. And Enter acts as the usual confirmation button. I suppose i had to modify it manually in the code and then save it and it would have changed the tag in the long form, then?
Anyway, as i said, multilines work. The position of the tooltip is still giving problems, though. Always at the right of the mouse cursor, cutting the tooltip if it is too long. Guess i'll try reading the involved code.