hello,
I have a question about when text length is too long, the tooltip will extend it's width automatic.
And if I set the tooltip's max size, I can use <WordWrapLeftAligned> let it change line automaticlly,too.
But when it change line, the tooltip's height doesn't extend itself.
I can only use a very stupid way to solve this problem, "getTextSize()" "getFont()" "getFontHeight()"
Calculate how many rows do I need, and setWindowSize() manually.
But it's not a good way, and I found that it can't satisfy my demand, if the text is very very long, my calculation will lost it's effect, the height by calculation is not enough.
Is there some way can do in the .looknfeel, so that it can auto extend the tooltip's height?
thanks for your help
Why tooltip can auto extend width, but height can't?
Moderators: CEGUI MVP, CEGUI Team
Re: Why tooltip can auto extend width, but height can't?
Can I know how many times of change line by <HorzFormat type="WordWrapLeftAligned" /> do?
The extend of height seems to depend on how many "\n" does the text content have.
So, If one row has auto change line by "WordWrapLeftAligned" twice, my tooltip's height will leak two rows height.
Does any more new idea?
The extend of height seems to depend on how many "\n" does the text content have.
So, If one row has auto change line by "WordWrapLeftAligned" twice, my tooltip's height will leak two rows height.
Does any more new idea?
Re: Why tooltip can auto extend width, but height can't?
here is the part of my .looknfeel content:
Code: Select all
<WidgetLook name="game1/ItemTooltip">
......
<NamedArea name="TextArea">
<Area>
<Dim type="LeftEdge" ><ImageDim imageset="game1" image="TooltipLeftEdge" dimension="Width" /></Dim>
<Dim type="TopEdge" ><ImageDim imageset="game1" image="TooltipTopEdge" dimension="Height" /></Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1" type="RightEdge">
<DimOperator op="Subtract">
<ImageDim imageset="game1" image="TooltipRightEdge" dimension="Width" />
</DimOperator>
</UnifiedDim>
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1" type="BottomEdge">
<DimOperator op="Subtract">
<ImageDim imageset="game1" image="TooltipBottomEdge" dimension="Height" />
</DimOperator>
</UnifiedDim>
</Dim>
</Area>
</NamedArea>
......
<ImagerySection name="staticText">
<TextComponent>
<Area>
<Dim type="LeftEdge" ><ImageDim imageset="game1" image="TooltipLeftEdge" dimension="Width" /></Dim>
<Dim type="TopEdge" ><ImageDim imageset="game1" image="TooltipTopEdge" dimension="Height" /></Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1" type="RightEdge">
<DimOperator op="Subtract">
<ImageDim imageset="game1" image="TooltipRightEdge" dimension="Width" />
</DimOperator>
</UnifiedDim>
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1" type="BottomEdge">
<DimOperator op="Subtract">
<AbsoluteDim value="4" />
<ImageDim imageset="game1" image="TooltipBottomEdge" dimension="Height" />
</DimOperator>
</UnifiedDim>
</Dim>
</Area>
<Colours topLeft="FFFFFFFF" topRight="FFFFFFFF" bottomLeft="FFFFFFFF" bottomRight="FFFFFFFF" />
<VertFormat type="TopAligned" />
<HorzFormat type="WordWrapLeftAligned" />
</TextComponent>
</ImagerySection>
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Why tooltip can auto extend width, but height can't?
This is surprisingly similar to the issues and such that were discussed recently as regards to formatting a ItemEntry for use in ItemListbox, and the reason it does not work is absolutely the same...
Basically, the existing WindowRenderer for Tooltip will just take the size of the text without alignment formatting (i.e. word wrapping and such) - this is incorrect and should be corrected.
The above issue aside, if we also factor in your need to have multiple texts / imagery sections as part of the tooltip, the correct solution then becomes to create a custom WindowRenderer subclass for Tooltip which i) uses the size of the texts after word wrapping, and ii) combines appropriate sizes according to your needs such that the final returned size is correct (and in creating the custom WindowRenderer, you work around the issue mentioned above).
I can't post a 'final' working solution to this as it's somewhat dependent upon the layout, and a layout agnostic solution is far beyond what I'm prepared to put here at the moment. I'm going to refer you to the ToolTip WindowRenderer code at: cegui_mk2/cegui/src/WindowRendererSets/Falagard/FalTooltip.cpp and also the discussion on the Listbox item sizing, which contains some mods you will likely need in order to get this to work (these mods will likely make Mercurial in the next couple of weeks): viewtopic.php?p=27931#p27931
[Edited]
Also, check here, as someone else is doing a very similar thing: viewtopic.php?p=27953#p27953
CE.
Basically, the existing WindowRenderer for Tooltip will just take the size of the text without alignment formatting (i.e. word wrapping and such) - this is incorrect and should be corrected.
The above issue aside, if we also factor in your need to have multiple texts / imagery sections as part of the tooltip, the correct solution then becomes to create a custom WindowRenderer subclass for Tooltip which i) uses the size of the texts after word wrapping, and ii) combines appropriate sizes according to your needs such that the final returned size is correct (and in creating the custom WindowRenderer, you work around the issue mentioned above).
I can't post a 'final' working solution to this as it's somewhat dependent upon the layout, and a layout agnostic solution is far beyond what I'm prepared to put here at the moment. I'm going to refer you to the ToolTip WindowRenderer code at: cegui_mk2/cegui/src/WindowRendererSets/Falagard/FalTooltip.cpp and also the discussion on the Listbox item sizing, which contains some mods you will likely need in order to get this to work (these mods will likely make Mercurial in the next couple of weeks): viewtopic.php?p=27931#p27931
[Edited]
Also, check here, as someone else is doing a very similar thing: viewtopic.php?p=27953#p27953
CE.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Who is online
Users browsing this forum: No registered users and 15 guests