sos, RenderedStringParser system ,help me

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

sos, RenderedStringParser system ,help me

Postby spracle » Wed Sep 15, 2010 12:22

2 problems:

1. [window] tag can't work ,here's my key codes:

Code: Select all

Listbox* Lbox = static_cast<Listbox*>(winMgr.getWindow("ChatItem/FrameWindow1/Listbox1"));
CEGUI::String tx2("[window='Animation/StaticImage1']");
ListboxTextItem *Lptr3 = new ListboxTextItem(tx2);
Lbox->addItem(static_cast<ListboxItem*>(Lptr3));

it seems that:Although there were some spaces for this window, it wasn't rendered

2."[colour='FFEE00D0']abcdefg[image='set:Button image:1']". With this code,this image also affected by the colour(obviously not my wanted). How can i avoid this situation?

By the way, I hope someone here can give me some tips for hyperlink implementation(am i too greedy :rofl: )

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

Re: sos, RenderedStringParser system ,help me

Postby spracle » Thu Sep 16, 2010 02:05

ok,now I can figure out my second question:

Code: Select all

void BasicRenderedStringParser::handleImage(RenderedString& rs, const String& value)
{
    RenderedStringImageComponent ric(
        PropertyHelper::stringToImage(value));
    ric.setPadding(d_padding);
    ric.setColours(d_colours);
    ric.setVerticalFormatting(d_vertAlignment);
    ric.setSize(d_imageSize);
    ric.setAspectLock(d_aspectLock);
    rs.appendComponent(ric);


if I comment this line : //ric.setColours(d_colours) ,then the image will remain what it really is (I don't need to set colour to images~~)
Or I can also write my string like this "[colour='FFEE00D0']abcdefg[colour='00000000'][image='set:Button image:1']" (it's rather complicated,worse than the first solution)

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: sos, RenderedStringParser system ,help me

Postby CrazyEddie » Thu Sep 16, 2010 10:53

The image colouring thing is by design - it's supposed to be a feature! :lol: The correct work-around for that should be "[colour='FFFFFFFF']" rather than 00000000 which should give you a totally transparent image (so maybe that is a bug?!).

The Window part is more involved. Basically, the window you refer to needs to already exist as a child of the window upon which you are setting the text containing the tag. Unfortunately, because ListboxTextItem and related classes are not Window based, this mean that having windows controlled / embedded within text in those items is not going to work properly. By switching to an ItemListbox which uses window based content as items (ItemEntry / skinned "<somelook>/ListboxItem" windows), and adding the tag target window(s) to those items, you can get it to work. This situation does preclude use of this specific ability in Combox lists and multi-column lists, since no ItemEntry based alternatives exist for those yet (this will be addressed for CEGUI 0.8.0).

To get hyperlinks / clickable text, you basically need a push button which only renders text.

CE.

User avatar
spracle
Not too shy to talk
Not too shy to talk
Posts: 34
Joined: Tue Aug 24, 2010 07:29

Re: sos, RenderedStringParser system ,help me

Postby spracle » Fri Sep 17, 2010 01:36

thanks CE,You are always so patient :D
The colour thing is my mistake .At that time I was wondering it should be [00000000] or [FFFFFFFF]. With not checking, I chosed [0000000] casually.Forgive me, :wink:
Finally, I understood why the [window] tag didn't work,sigh~~ Next, i will give it a try to change the itemListbox with entryItem.( In fact, i'm building gamechatbox ).

The hyperText idea is pretty cool,but in my opinion it isn't flexible.Because,the size is auto changed by the length of the text( I am about to use it in the gamechatbox) .

I hope you can follow the topic ,CE.I may well have other problems.

IR3uL
Not too shy to talk
Not too shy to talk
Posts: 45
Joined: Wed Aug 25, 2010 00:32
Location: Buenos Aires - Argentina

Re: sos, RenderedStringParser system ,help me

Postby IR3uL » Fri Sep 17, 2010 01:44

spracle wrote:The hyperText idea is pretty cool,but in my opinion it isn't flexible.Because,the size is auto changed by the length of the text


That's easy, to get the width of the text use Font::getTextExtent(), and for the height Font::getFontHeight(). =D


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 9 guests