Page 1 of 1

Need some help implementing a specific window

Posted: Wed Nov 25, 2009 10:54
by asafy3
Hey everyone,

First of all, as a followup to my post about a month ago, I got to say that I'm in love with the system. After getting over the initial "shock" and after I started working with the actual Looknfeel files and the actual C++ coding of CEGUI, I am at awe at how easy everything is coming together (almost everything, hence my question :) ), and how elaborate the library really is.

To my question: I have been requested by our UI art director to create a fairly simple window, but I'm not sure how to go about doing it.

Here's the window's mock up as presented to me:

Image

I have no problem setting the window title and back button, and I already created a window much like the right window, so no problems there.

However.. The left window is a bit of a problem for me. I need to create a window, with a scroll bar that responds to the amount of text objects in the table itself. In addition, the top 4 labels (Name, Size, Minerals, Climate) will sort the text objects in the table. The items in the table are injected from a List, and I'm not entirely sure which widget is best used for that.

My questions are:

1) How do I hook up the actual vertical scroll bar to respond and activate the text objects? Ideally, it's size will be affected by the number of planets.

2) I need to group up 4 static text boxes for each entity (For example: Alpha1, 6, Normal, Ideal all represent the same planet) since they need to move altogether when a different sorting method is activated. I thought about making the planet Name (Alpha1) as the parent static text item, and the rest of the fields (6, normal, ideal) as it's children, but I'm not sure it's wise.

3) What is the best method to create the sorting algorithm? I assume it is tightly related to how I define the actual planet entity.

I promise a beer to the person that can conjure up a solution!

Cheers, :pint:

Re: Need some help implementing a specific window

Posted: Wed Nov 25, 2009 12:27
by ianstangoe
Take a look at demo7, it seems to have exactly the kind of window your looking for, it even includes sorting by field type :wink:

Re: Need some help implementing a specific window

Posted: Wed Nov 25, 2009 19:42
by asafy3
Hey Ian,

Thanks - Following the example in Demo7 I was able to get an up and running multi column list window, but I have a small question that I just couldn't find an answer to: Is there any way to set the height of each row?

Any help will be appreciated. :)

Re: Need some help implementing a specific window

Posted: Fri Nov 27, 2009 14:18
by ianstangoe
To be honest I've not looked at the code but I assume there are properties you can set on the window to adjust height/width and various others, or it may be something you can tweak in the looknfeel file.

Re: Need some help implementing a specific window

Posted: Fri Nov 27, 2009 15:21
by asafy3
Yep, I looked in both. The code part seems to only allow changing the textual elements within the item, such as font and actual text, and the LooknFeel file seems to have no effect.

Is it possible that this is caused because I'm using a ListboxTextItem and not just a ListboxItem - Reason I'm using a textItem is because I couldn't initialize a regular ListboxItem.

This might be the root of the problem, since the only LooknFeel widget I have that's slightly similar is a ListboxItem, not a ListboxTextItem.

Here's the code I use to inject new items to the list:

Code: Select all

CEGUI::ListboxTextItem* Item = new CEGUI::ListboxTextItem("");
PlanetList->setItem(Item, 0, i);

Re: Need some help implementing a specific window

Posted: Fri Nov 27, 2009 16:59
by Jamarr
As far as I am aware the MultiColumnList requires the use of ListboxItem objects, which are not falagard/window based; meaning you cannot modify them via the .looknfeel file. I would assume that these objects auto-size based on the size of the font associated with them, so you should be able to manipulate their height by increasing the font-size. If you want to increase their height without increase the font-size, then you will likely have to derive a custom class from ListboxItem (or ListboxTextItem) with which you can modify the height yourself.