About Listbox & ItemListbox

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

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Wed Sep 23, 2009 17:06

Well I just tried to put icons into the chat text and i get a lockup within "CEGUIRenderedStringWordWrapper.h:103". The while loop in line 103 does never actually end.

I use the following string:

Code: Select all

"[image='set:{0} image:{1}'][colour='{2}'][font='{3}'] You[font='{4}']{5}: {6}"


Ignore the {number} they are being replaced by a string formatter. Is the Image command correct? Because if i use this:

Code: Select all

"[image='set:{0}' 'image:{1}'][colour='{2}'][font='{3}'] You[font='{4}']{5}: {6}"

It does not hang up, but it also does not show me the icon :(

Oh and another thing, the string is rendered half transparent, I guess its because I do not render the listbox, because I disabled the background texture.
How do i turn of the alpha for the strings?

Any ideas?


Thanks in advance!

Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Wed Sep 23, 2009 18:37

Jeez :lol:

The first format is correct as far as what should work. You're certain the image and imageset names that get replaced in the string are correct? I know you probably already checked, but I have to ask.

I can't test anything myself until tomorrow, but can you let us know how wide the image is, and how wide the listbox is, thanks :)

CE.

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Wed Sep 23, 2009 20:33

Hey CE :)

Well the image i use is 64x64 Pixel in size. The Size of the Listbox is 1/3 in width of the screen size.

About the Alpha Blending, any idea what that could cause? The Listbox itself is not alpha blendet. I just removed the background images so you're only able to see the chat and the rendered scene behind it. However, after using your custom TextItem, the text is actually rendered with alpha if I have to guess it would be at a 0.4f scale. Dunno where this is coming from.

Anyways, I'll try a shorter image in the meantime ;)


Thanks again!

Mfg Imp

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Thu Sep 24, 2009 07:35

Hey there,

well about the image. I kinda "solved" it, I had to disable the AutoScaled property within the ImgaeSet otherwise the texture would have been grown to 1024x768 and thereby extendet the string to a much greater size then the actual screen and thats where the while loop did not end.

I changed the icon texture to a size of 320x320 because i do have 5x5 Icons in it each in size of 64x64 pixel. The problem here is that i cannot manage to get every single icon drawn correctely. They are all shifted in coordinate although i checkt their size and coordinates twice within the imageset. And yet i have to set AutoScaled to true otherwiese it just dont work. What exactely does this flag do anyway?

Ah, and two more questions rised while I was on it ;)
1) Is it possible to scale the image which rendered within the listbox upd/down? Is there a command to change the size of an image within the string command like:

Code: Select all

"[image='width= height=']" ?


2) Right now the image defines the size in terms of the height of a string line. My question here is, how do i center the text verticaly to the image. Right now the text is aligned to the bottom of the image, but I want it to be centered to the image height. Is this even possible? And furthermore, how do i get line spacing working. Because if I put another line with an icon right beneath the first, the image is exactely under the prevoius one, there is no space inbetween :(

About the alpha, I was plain stupid, I used the correct color but forgot to actually convert it into hex .. ;)

Thanks in advance!

Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Thu Sep 24, 2009 09:01

Hi,

Some of the other things in your post are interesting, to say the least ;)

First, the issue with the word-wrapper hanging is obviously a bug, and we'll get that fixed ASAP.

1) The Autoscaled option, as described in the docs:
AutoScaled: Boolean property that states whether to scale imagery so it appears the same physical size at any resolution. The specified native resolution values indicate the resolution that will result in a one-to-one (i.e. unscaled) mapping from source to destination. At resolutions higher than the native, the imagery will be scaled up to take up more space, and at resolutions lower than the native, the imagery will be scaled down to take up less space. Optional attribute, default is false.

The thing there is that setting it either way does not effect the size of the texture used to store the imagery - that's always whatever the source file size is (maybe scaled up to nearest power of 2, depending on API and hardware support).

With regards to the other points, the system does actually has configuration for this alignment for top, bottom, centred and stretched. There's also provisions for padding values. However, the current basic parser contains these lines(!):

Code: Select all

    // TODO: Add support for parsing vert formatting specifications.
    // TODO: Add support for parsing padding specifications.


So, as you can see it's on the cards, it's just not quite ready yet :oops:

The basic parser currently does not support modification of an image size, though it's a good suggestion ;) Be aware you can replace the parser provided with something custom made if you require different behaviour ;)

With regards to a lack of spacing between the items (and aside from the missing 'padding' parse factility mentioned above). I did say in my earlier post:
CrazyEddie wrote:You can probably improve it a bit by adding some padding to the items and such things.

Basically to do this you just add some vertical space in the getPixelSize function, and in the draw function, add half of that amount of space to the 'y' position (so the content is centred in it's item).

CE

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Thu Sep 24, 2009 10:41

Hey CE thanks for your answer!

In regards to:
With regards to the other points, the system does actually has configuration for this alignment for top, bottom, centred and stretched. There's also provisions for padding values. However, the current basic parser contains these lines(!):
// TODO: Add support for parsing vert formatting specifications.
// TODO: Add support for parsing padding specifications.


I must've missed them, sorry :oops:

Regarding the image size, thats a quite cool feature. I've should have read the whole doc tho :twisted:
Anyways I still have trouble getting the icon shown correctly. As i said before, I have icons in 64x64 pixel size. And i set the size and coordinates within the image set file correct as far as I can tell. Nevertheless they are drawn like the x-start point of an icon is not 0, 64, 128, etc its more like the half of it. So The icons get drawn mixed up. I've looked into the sample image sets and I cant find a difference :(

About the parser replacement. I guess if I want to replace it, I have to do it actually within the CEGUI lib, or is there a way to register an external parser?

About the spacing. I Actually tried to change the y-value, which works but I'd no clue how to get the previous item (the icon) to get its height to compute the y-value depending on it. Or even better get the item within the string with the highest hight and compute the middle of that. Is there a way to access these items within the ListBoxTextItem?

Thanks in advance!

Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Thu Sep 24, 2009 11:19

Anyways I still have trouble getting the icon shown correctly. As i said before, I have icons in 64x64 pixel size. And i set the size and coordinates within the image set file correct as far as I can tell. Nevertheless they are drawn like the x-start point of an icon is not 0, 64, 128, etc its more like the half of it. So The icons get drawn mixed up. I've looked into the sample image sets and I cant find a difference :(

Any chance of a screenshot to show that - a picture is worth a thousand words, and all that ;) Or you can send me the Imageset if you like and I'll test it.

About the parser replacement. I guess if I want to replace it, I have to do it actually within the CEGUI lib, or is there a way to register an external parser?

No, no need to do this inside CEGUI. Currently you create your CEGUI::RenderedStringParser subclass and use it how you like - for Window objects it's assigned by Window::setCustomRenderedStringParser, for ListboxItems, you can use it directly in your subclass (in the case of the code I posted previously, you'd be best advised to duplicate the parts inherited from ListboxTextItem, replace the parser, and inherit directly from ListboxItem instead). In the future there will indeed be a way of registering parsers for a more seamless way of integrating custom parsers (this will be in the first 'new feature' release of the 0.7.x series, though as you probably guessed, we're in all out bug-fix mode right now ;)).

About the spacing. I Actually tried to change the y-value, which works but I'd no clue how to get the previous item (the icon) to get its height to compute the y-value depending on it. Or even better get the item within the string with the highest hight and compute the middle of that. Is there a way to access these items within the ListBoxTextItem?

I may have confused the issue here. I thought you meant spacing between each item in the list, but now I think you mean spacing between wrapped lines within one item? If that's the case then the TODO 'padding' item that will perhaps get you what you need.

For info, a new release is intended shortly - once we think we have most of these initial batch of bugs found and fixed. Depending on how that goes, I may get the tag support in that will expose the vertical alignment and padding; watch this space.

CE.

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Thu Sep 24, 2009 13:06

Hey,

Any chance of a screenshot

of course:
Image

As you may see, the icons of the text items are directely beneath each other (atleast within the two first lines) and scaled. They dont fit the orinal image size. Furthermore as you may see at icon at the left bottom, the image is quite wrong, there are two icons mixed up.

Here is the image set

Code: Select all

<?xml version="1.0" ?>
<Imageset Name="avatar_tileset" Imagefile="data/gfx/avatars/avatar_tileset.tga" NativeHorzRes="800" NativeVertRes="600" AutoScaled="false" ResourceGroup="avatars">
   <Image Name="m_avatar_001" XPos="0" YPos="0" Width="64" Height="64" />
   <Image Name="m_avatar_002" XPos="64" YPos="0" Width="64" Height="64" />
   <Image Name="m_avatar_003" XPos="128" YPos="0" Width="64" Height="64" />
   <Image Name="m_avatar_004" XPos="192" YPos="0" Width="64" Height="64" />
   <Image Name="m_avatar_005" XPos="256" YPos="0" Width="64" Height="64" />
</Imageset>


Maybe you find something I have overlooked :)

PS: I've another string formating related question. How do i actually put a "[" and "]" into my string without them being removed oder interpreted as a command?

Thanks in advance!

Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Thu Sep 24, 2009 18:17

Hi,

I can confirm some apparent strangeness with images in strings, especially with autoscaling - I don't have much more info at the moment, since I gave myself a headache with all this stuff earlier :lol: This will be fixed over the next couple of days - sorry for the inconvenience.

With regards to the image at the lower left corner of the screenshot posted, what kind of widget is that using? And is the content there again using a string with control tags in?

I've another string formating related question. How do i actually put a "[" and "]" into my string without them being removed oder interpreted as a command?

You can escape the opening [ with a backslash, like this "\[" if you're doing it in C/C++ code you have to escape the backslash first, so you put "\\[". You do not currently escape the any closing ']', control string detection is done solely on the opening ']'. I think this area needs some work to be more robusto! Perhaps we will end up with an alternate version of this soon :hammer:

CE.

Edited to fix backslashes :oops:

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Fri Sep 25, 2009 08:46

Morning :)

With regards to the image at the lower left corner of the screenshot posted, what kind of widget is that using? And is the content there again using a string with control tags in?


It's just an WindowFrame with an StaticImage init. And i do not use any string formatters in it.

Thanks for the escaping clerification! :)

Btw: Is the CEGUI svn open to use, so that one could update its version more frequently like if a minor/major bug has been fixed?


Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Fri Sep 25, 2009 10:50

Thanks for the info - should hopefully come up with some answers for you shortly :)

Btw: Is the CEGUI svn open to use, so that one could update its version more frequently like if a minor/major bug has been fixed?

Yes, and I'd be most happy if everyone used it, since it removes some of the 'pressure' to get the releases right - especially binaries.

The SVN repository is at sourceforge, the base URL is

Code: Select all

https://crayzedsgui.svn.sourceforge.net/svnroot/crayzedsgui/


For the actual CEGUI code, you want the cegui_mk2 subdirectory, and within that there's the usual trunk, branches, tags type of layout. Here you should be using the v0-7 branch, since it will be relatively stable and is where all the fixes will get put initially (and merged back to trunk on a weekly basis). So the actual URL to use is:

Code: Select all

https://crayzedsgui.svn.sourceforge.net/svnroot/crayzedsgui/cegui_mk2/branches/v0-7/


Above where I say 'relatively stable', I mean that very occasionally a fix made on one system will break the build on another (fx, if I make a fix on Linux, it may break the build on Windows, or vice-versa) - though this only happens very rarely, and is generally fixed within a few hours ;)

For our new docs on this please see:
http://cegui.org.uk/docs/0.7.0/downloading.html for obtaining the code (SVN details at the bottom, though I just noticed the URL is incorrect! Seems CE can't get anything right at the moment! :cry: ). and...
http://cegui.org.uk/docs/0.7.0/compiling.html for compilation details, if you're previously coming from a binary release.

HTH

CE.

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Sat Sep 26, 2009 08:38

Ok. I am looking into this again this morning. My own issue with scaling was due to incorrect native resolution, so I do not think this is related to your issue.

As you may see, the icons of the text items are directely beneath each other (atleast within the two first lines) and scaled.

The top icon there is clearly incorrect, I have not looked into that yet. In relation to the icons being scaled, in the image they are 64 x 64 pixels - as per the definition in the Imageset, so I'm not sure if I've misunderstood something, but as I understand things at the moment, this means they're not scaled (and is correct - at least as far as the way I wrote it). Perhaps the best way for you to explain the differing result is for me to ask - how large should the icons have been?

In relation to the inconsistent images coming out of the imageset (and perhaps related to the issue of the lower-left icon), I wonder if it's related to the way the image is loaded to the texture? I thought we'd addressed all these issues, although it's possible that we did not. To confirm or eliminate this, what happens if you modify the size of the image texture so it has power of two dimensions? Also, which renderer are you using? :)

CE.

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Mon Sep 28, 2009 13:49

Ok. I come bearing gifts :)

I have added some new stuff to the BasicRenderedStringParser in order to expose the padding and vertical alignment settings and some totally new support for specifying image sizes.

The for vertical alignments I have aded a 'vert-alignment' tag that accepts values of 'top', 'bottom', 'centre', and 'stretch'. Note that the 'stretch' option only stretches is the vertical direction (i.e. it does not maintain aspect, at some stage I'll implement the aspect-lock tag that I've added, though it's requires some large-ish chunks to be rewritten and probably will require interface breaks, so it will not get done until 0.8.0 probably).

For padding we have the tags 'padding', 'left-padding', 'right-padding', 'top-padding' and 'bottom-padding'. The 'padding' version takes a Rect property specification, the others all take simple floats.

For image sizes we have the tags 'image-size', 'image-width' and 'image-height'. The 'image-size' version takes a Size property specification, the others take floats. Setting an image dimension to 0 will cause it to use the dimension from the image itself (i.e. the default behaviour).

Remember that - as with the other tags - these all work as a state-machine so if you add padding or alignment somewhere, you may have to remember to 'remove' it again later in the string if it's no longer needed!

[Edit}
Btw, I also fixed the hang in the word-wrapper code ;)

HTH

CE.

Impz0r
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Fri Sep 04, 2009 12:54

Re: About Listbox & ItemListbox

Postby Impz0r » Tue Sep 29, 2009 05:48

Hey CE thats great news!

Sorry that i answer thus late, I'm kinda busy right now.. between couple projects myself ;)

We had to rewrote our inhouse-game engine, thereby I cannot test the new gui code as of now, but I will soon! :)

But thanks for your answer and of course the changes you've made, especially the new image tags looking quite promising.
I hope I'm able to test them soon.


Mfg Imp

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

Re: About Listbox & ItemListbox

Postby CrazyEddie » Tue Sep 29, 2009 09:32

Hey, no problemo!

Thanks for reporting the issues and making suggestions - it makes CEGUI better for everyone :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 17 guests