Making a list box selectable [Solved]

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

Scorch
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Mon Feb 13, 2006 07:05
Location: Las Vegas, NV

Making a list box selectable [Solved]

Postby Scorch » Sat Mar 25, 2006 21:24

I am using 0.4.1 CEGUI, and the CEGUI layout editor.
I have a page with 2 list box's on them. I can add to my list boxes text and it apears just fine.
Problem is I want to make the list box items selectable, right now you click on them and nothing happens. They should highlight or somthing right?

Do i have to register for handlers and somehow highlight them myself?

Here is my layout file:


Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<GUILayout>
<Window Type="DefaultWindow" Name="Lobby_Root" >
<Property Name="UnifiedAreaRect" Value="{{0.000000,0.000000},{0.000000,0.000000},{1.000000,0.000000},{1.000000,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/FrameWindow" Name="Lobby_LobbyWindow" >
<Property Name="CaptionColour" Value="00FFFFFF" />
<Property Name="EWSizingCursorImage" Value="set:TaharezLook image:MouseEsWeCursor" />
<Property Name="Font" Value="Tahoma-12" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="NESWSizingCursorImage" Value="set:TaharezLook image:MouseNeSwCursor" />
<Property Name="NSSizingCursorImage" Value="set:TaharezLook image:MouseNoSoCursor" />
<Property Name="NWSESizingCursorImage" Value="set:TaharezLook image:MouseNwSeCursor" />
<Property Name="TitlebarEnabled" Value="True" />
<Property Name="TitlebarFont" Value="Tahoma-12" />
<Property Name="UnifiedAreaRect" Value="{{0.012500,0.000000},{0.022917,0.000000},{0.985937,0.000000},{0.987500,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
<Window Type="TaharezLook/Listbox" Name="AvailableServers" >
<Property Name="Font" Value="Tahoma-12" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="MultiSelect" Value="True" />
<Property Name="Sort" Value="True" />
<Property Name="UnifiedAreaRect" Value="{{0.039968,0.000000},{0.092656,0.000000},{0.720145,0.000000},{0.848056,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="Lobby_Cancel" >
<Property Name="Font" Value="Tahoma-12" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="Cancel" />
<Property Name="UnifiedAreaRect" Value="{{0.807384,0.000000},{0.889850,0.000000},{0.959470,0.000000},{0.958424,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Button" Name="Lobby_OK" >
<Property Name="Font" Value="Tahoma-12" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseArrow" />
<Property Name="Text" Value="OK" />
<Property Name="UnifiedAreaRect" Value="{{0.628090,0.000000},{0.888337,0.000000},{0.778572,0.000000},{0.963391,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
<Window Type="TaharezLook/Listbox" Name="Lobby_ServerStatistics" >
<Property Name="Font" Value="Tahoma-12" />
<Property Name="MouseCursorImage" Value="set:TaharezLook image:MouseTarget" />
<Property Name="UnifiedAreaRect" Value="{{0.752167,0.000000},{0.094168,0.000000},{0.970064,0.000000},{0.843089,0.000000}}" />
<Property Name="UnifiedMaxSize" Value="{{1.000000,0.000000},{1.000000,0.000000}}" />
</Window>
</Window>
</Window>
</GUILayout>


I tried turning on MultiSelect to see if that did anything, but nothing so far.

Any idea's?
Last edited by Scorch on Sun Mar 26, 2006 21:12, edited 1 time in total.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Sun Mar 26, 2006 18:19

You need to set the selection colour and the selection brush image for each item.

[edit]This can only be done from code as you cannot define the list items from XML[/edit]

Scorch
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Mon Feb 13, 2006 07:05
Location: Las Vegas, NV

Postby Scorch » Sun Mar 26, 2006 20:52

Ok, I believe you. But I can't find the code that does this.

I looked though the CEGUIListbox.h and CEGUIWindow.h and I cant find any set, select, or color that suggests it will do as you suggest.

I also did a couple find in files of the whole CEGUI directory, and the only thing I can find is text lines in one of the demo xmls.

i'm going to do some more wiki searchs and look through the demo code, but if you can point me in the right direction that would be great.

Scorch
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Mon Feb 13, 2006 07:05
Location: Las Vegas, NV

Postby Scorch » Sun Mar 26, 2006 21:11

Found it!
found a wiki page:
http://www.cegui.org.uk/wiki/index.php/FAQ

And I am now able to highlight selected items!

Thanks!

Wasn't obvious to me because I didn't realize I could set the selection color individualy for each item. But I can see where that would be usefull.

I am suprised there isn't a default color section for the listbox available in XML. But thats ok now that I got it working.

User avatar
arkos
Quite a regular
Quite a regular
Posts: 49
Joined: Thu Apr 27, 2006 21:45

Postby arkos » Mon Aug 21, 2006 20:44

I just wanted to add something.

If you are using WindowsLook, you need to make sure that the ListboxSelectionBrush exists in the imageset file. Then you need to make sure that the square it corresponds to in the targa file has a white alpha. The actual color channel can just be left blank because you are giving it a color when you setSelectionColours().

I was beating my head on a table for hours trying to figure why the selection wouldn't show up!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests