Can't customize ListboxTextItem

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

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Can't customize ListboxTextItem

Postby Chaos » Fri Feb 01, 2008 13:47

Hi!

Could you give me a hint where I can change the text- and selectioncolor of a listboxtextitem, please?
I tried to change the colors in the LookAndFeel-file (Listboxitem), but that didn't work. I also tried to create a LookAndFeelItem which is called ListboxTextItem und linked it in the scheme-file, but that didn't work too. ;-C

Can you help me, please?

Bye,
Chaos

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Fri Feb 01, 2008 14:16

Excerpt taken from WidgetGalore:

A Listbox widget controls either a single selection or multiple selections among many choices. Multiple selections are enabled via setMultiselectEnabled().

The choices are listbox text items (ListboxTextItem) added to the listbox via addItem(). These do not possess a selection indicator by default; one must be specified via setSelectionBrushImage(). The call to ensureItemIsVisible() ensures that the item is visible; the listbox will automatically scroll down if necessary. The text of the ListboxTextItem can be changed via the setText() function. However this new text will not be displayed until you call the Listbox's handleUpdatedItemData() function.

--------

Regarding the creation of new list items have a read through Create a CheckListboxItem.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Fri Feb 01, 2008 16:28

Hi!

I already knew that, but thanks anyway. I just thought that there could be a solution without coding the colors. How can I vary the look in disabled state?
The TextItems are disabled but I still can click them and they look the same like the enabled ones.

Do you know if its possible to increase the distance between the entries of the multicolumnlistbox?

And how can I change the size and color of the listheadersegment?

Bye, Chaos

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 » Fri Feb 01, 2008 21:09

@disabled state: a ListboxItem has both an enabled and disabled StateImagery, which is 'connected' to the actual runtime state of the item. I don't know which looknfeel you use, but you could add a disabled text colour like this, which is Gray as opposite to the selected Black:

<WidgetLook name="WindowsLook/ListboxItem">
<PropertyDefinition name="TextColour" initialValue="FF000000" redrawOnWrite="true" />
<PropertyDefinition name="DisabledTextColour" initialValue="FF888888" redrawOnWrite="true" />

Also alter the StateImagery to point to this new textcolour:
<StateImagery name="Disabled">
<Layer>
<Section section="label">
<ColourProperty name="DisabledTextColour" />
</Section>
</Layer>
</StateImagery>

You can perform the same trick to add a new colour for the "Selected Disabled" state.

-----
Not sure if you can change distance between items.

----
You can access listheadersegments throught a getter, assuming you are now talking about the MultiColumnList, which allows you to change it's size. But i don't know about the colours.

Let me know if that looknfeel part was too heavy for now ;)
Check out my released snake game using Cegui!

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Mon Feb 04, 2008 09:02

Thanks for your information scriptkid.

But your solution doesn't work. When I change the textcolor of the Listboxtextitem in my Looknfeel nothing happens.
I have to use the setTextColor function and so on to give my items a color.

That's why I'm asking how I can fix that problem.

Btw.: I'm using a modified version of the Taharezskin/looknfeel.

Do you know how to change the selectionbrush in that way, that it doesn't fades out anymore? -> FIXED!

The fontsize of the headersegments I could already change, but don't know how to change the color. Maybe I should change the defaultcolor of the windowelement? If so, how can I do this? :D

Bye

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

Postby CrazyEddie » Mon Feb 04, 2008 12:09

Just to confirm a couple of bits of info...

Which version of the library are you using?
Which type of listbox are you using, the original Listbox or the new ItemListbox?

Thanks,

CE.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Mon Feb 04, 2008 12:41

Hi!

Nice to meet you CE.

I'm using the Version 0.5.0 b and the MultiColumnList because I need 3 Columns.

Bye Chaos

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

Postby CrazyEddie » Mon Feb 04, 2008 14:01

Hi :)

I'm using ... the MultiColumnList


Yeah, that's the issue. The items you add to that, which you create directly, are not 'skinned'. In order to customise these items (based on CEGUI::ListboxItem) you'll need to set options on the objects you create directly (see API reference here and here) - or even subclass it and write something that does what you need.

CE.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Mon Feb 04, 2008 15:47

Okay,... I decided to create the list with static text and radiobuttons, because I don't want to programm my own widget. :(

Thanks anyway CE!

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

Postby CrazyEddie » Mon Feb 04, 2008 17:04

Can't you do:

Code: Select all

#define BLUE 0xFF0000FF
...
myItem->setTextColours( BLUE );
...

Where myItem is a ListboxTextItem? Or is there something else blocking you too?

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Tue Feb 05, 2008 09:42

Well the thing is: I want to implement a list where available levels are listed and nonavailable levels of my game are disabled (visible but not clickable).
Furthermore I need 2 more columns to show the Highscorepoints and the players rank in this level. The columnheadersegments should be in the same fontcolor as the listboxtextitems in the list. All entries schould have a distance of 3 px to each other and the text shouldn't be cut off like it does at the moment (a normal "g" is not visible completely).
An other point is, that the entries of the list should have a rectangular background in a soft color and a selectionstate which is looks a bit darker than the normal state (I'm speaking of the rectangle).

So, you see... there are many problems witch this listboxstuff. I would be very glad if you and your team would reinvent the listbox in a better way, because now the listbox is not as good as the rest of your GUI.

Bye Chaos

PS: I'm scripting the GUI with LUA so I can't do "special moves" with C++ ;-)

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

Postby CrazyEddie » Tue Feb 05, 2008 19:27

I understand that the current implementation is obviously not flexible enough to do what you want :(

Chaos wrote:I would be very glad if you and your team would reinvent the listbox in a better way

That's unlikely to happen any time soon.

Chaos wrote:because now the listbox is not as good as the rest of your GUI.

I agree. The Multicolumn List has more hacks than your average tabloid paper :lol:
The newer ItemListbox is very, very good (though does not support multi columns, so is not a lot of use for what you want).

Chaos wrote:PS: I'm scripting the GUI with LUA so I can't do "special moves" with C++ ;-)

Cool. I think the Lua scripting support is one of our stronger features.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Thu Feb 07, 2008 19:47

CrazyEddie wrote:I understand that the current implementation is obviously not flexible enough to do what you want :(

That's unlikely to happen any time soon.


I really hope so, because it's really hard to implement a Gui without Multicolumnlistboxes. :)
Btw.: Do you any solution to create an object where the user can change the controlsettings of the game? There has to be the caption and a primary and secondary keyvalue in the list. Maybe you know somebody who has solved that problem with the current CEGUIversion without programm something new.


CrazyEddie wrote:Cool. I think the Lua scripting support is one of our stronger features.


What do you mean? On the website I haven't seen LUA Code very often. But in my opinion is LUA in combination with CEGUI one of the most flexible GUI that exists. I've created kinda classes and objects with arrays and a Managerlibrary which handles the information for the Userlayer of the GUI.

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Thu Feb 07, 2008 20:06

Chaos wrote:Do you any solution to create an object where the user can change the controlsettings of the game? There has to be the caption and a primary and secondary keyvalue in the list. Maybe you know somebody who has solved that problem with the current CEGUIversion without programm something new.


The description of your need is a little vague. Are you talking about mapping keyboard keys to game actions?
Last edited by Rackle on Thu Feb 07, 2008 20:38, edited 1 time in total.

Chaos
Just popping in
Just popping in
Posts: 15
Joined: Fri Jan 25, 2008 15:21

Postby Chaos » Thu Feb 07, 2008 20:15

EXACTLY! :D

Sorry for my bad english and explanation! :oops:


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests