How to place child windows on top of listboxitem

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

How to place child windows on top of listboxitem

Postby singbol » Wed Sep 16, 2009 09:35

That I come up with this question is because I want to solve a problem like below:
/////////////////////////////
// // // ////// ///// //
// 1 2 3
// // // ////// ///// //
/////////////////////////////
Which is one item of a Listbox, I want to place some child windows
on top of this item, but I look into ListboxItem class, it's not derived from Window, yeah,
it has a member that named d_owner, I tried to use it(d_owner->addChildWindow) to add
child windows, but it is wrong, the vs compiler didn't successfully complied it.

Can u follow me? :( That I want to use Listbox to place some items, which are not as simple as TextItems.
If Listbox can't do me this favour, what shall I do next?I also have thought of ImageButton,
but when I have clicked one ImageButton, it comes back to "Normal" state again, I wanna it be in
Pushed(or selected)

User avatar
Jabberwocky
Quite a regular
Quite a regular
Posts: 86
Joined: Wed Oct 31, 2007 18:16
Location: Canada
Contact:

Re: How to place child windows on top of listboxitem

Postby Jabberwocky » Wed Sep 16, 2009 12:28

Hi Singbol,

You might want to try using CEGUI::ItemListbox. It allows you to put different kinds of things inside of your listbox, like images.

You can even construct a window that has a combination of multiple images and text, and put that inside the ItemListBox.

You should probably put these questions inside the beginner's help forum.

Hope that helps!
The Salvation Prophecy
Space Combat. Planet Exploration. Strategic Domination.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Wed Sep 16, 2009 13:49

Thank you very much!!!!!
But I don't really understand at this time.Do you mean that I first using ItemListbox, then add ListboxItem to it.But I can't place windows onto ListboxItem!Or I make something wrong.

I want to have a window, in this window, there are items like
----------------------------------Item1
----------------------------------Item2
----------------------------------Item3
and for each item, I want to place child windows on them, static image、static text and so on

Waiting for your answer to me! :)

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: How to place child windows on top of listboxitem

Postby Jamarr » Wed Sep 16, 2009 15:48

The ItemListbox accepts ItemEntry objects. You should find your answer if you Search.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Wed Sep 16, 2009 16:04

First off, thank you for your reply!
I tried to define a class that inherit from ItemEntry, but When I run my application, it get assertion that say I should implement the getItemPixelSize member function of ItemEntryWindowRenderer, which makes me fuzzy.I've taken your advice and searched the forum, I can't find how to use the ItemListbox exactly!
Waiting for your help and I'll try to find it by myself too.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Wed Sep 16, 2009 16:15

I get the exception message again:
ItemEntry::getItemPixelSize - This function must be implemented by the window renderer module.
Why?what should I do then?

User avatar
Jabberwocky
Quite a regular
Quite a regular
Posts: 86
Joined: Wed Oct 31, 2007 18:16
Location: Canada
Contact:

Re: How to place child windows on top of listboxitem

Postby Jabberwocky » Wed Sep 16, 2009 18:09

The Salvation Prophecy

Space Combat. Planet Exploration. Strategic Domination.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Thu Sep 17, 2009 02:17

Thank you!
I've gone through this topic you gave me, but I don't understand yet.What I need is a control that can handle many Items like ListboxItem and I can set the height of each item, also what I need is when I click on one of these items, it keeps the selected state(a selection brush).for each item, I can place child window on it.at this time, I want to put StaticImage、StaticText、StaticImage、StaticImage to it.
although you all give me some good advice!but I can't make me clear enough to follow you( :oops: )I'm not that experience!what's the easiest way to get the exact solution?If only you place some code here! :) , or explain it to me some more deep!
YOUNG Singbol.

User avatar
Jabberwocky
Quite a regular
Quite a regular
Posts: 86
Joined: Wed Oct 31, 2007 18:16
Location: Canada
Contact:

Re: How to place child windows on top of listboxitem

Postby Jabberwocky » Thu Sep 17, 2009 05:35

Sorry, that link is the best I could find for you. I don't have any specific code to give you.

I understand that this is one of the more complicated things to do in CEGUI version 0.6 and below.
I believe version 0.7 is going to make this much easier. You may want to wait for 0.7 to be stable and officially released, then use that.
The Salvation Prophecy

Space Combat. Planet Exploration. Strategic Domination.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Thu Sep 17, 2009 06:14

Ok, Thank you all the same!

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

Re: How to place child windows on top of listboxitem

Postby CrazyEddie » Thu Sep 17, 2009 09:02

When you use the ItemListbox as opposed to the normal listbox, the content is Window based (using ItemEntry based type windows). This means that these items - that are created like other windows, either via the CEGUI::WindowManager or in layout xml (the window type is for example, named "TaharezLook/ListboxItem") - can have other windows added to them, additionally they can be skinned via the looknfeel XML so can have a 'standard set' of embedded windows if so desired. I do not think there is any need here to create any new classes or anything, the existing implementation should do just fine - though you may decide you need to customise the WidgetLook XML definition a bit.

I understand that you're not experienced, and we'll all try and help where possible, though do note that it's not always possible for us to post full code examples :)

CE.

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Thu Sep 17, 2009 09:13

Thank to CE,
I'm sorry that I post a new topic in the beginners help subforum.
But I can't wait to find the solution, pardon me!
And how to achive this?no new class?But what should I do then?I tried to create ItemEntry obj, but it gives me the exception who says "ItemEntry::getItemPixelSize must be implemented ..."

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Thu Sep 17, 2009 10:07

Thx to CE and U all!I've solved this problem! :D

singbol
Not too shy to talk
Not too shy to talk
Posts: 36
Joined: Sun Aug 23, 2009 04:44

Re: How to place child windows on top of listboxitem

Postby singbol » Thu Sep 17, 2009 10:15

But What if I want add image to listboxitem?I want to give the listboxitem background image, too

Edit:And How about the items spacing, item between item.I want 0px or N px between each item. :wink:

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

Re: How to place child windows on top of listboxitem

Postby CrazyEddie » Thu Sep 17, 2009 18:58

You should be able to solve these issues by way of the WidgetLook definition for the ListboxItem in thelooknfeel. The background image would just be an ImageryComponent that draws the appropriate image, if you need to to be configurable, then you define a property as the source of the image. To add some space between the items, adjust the WidgetLook definitions so that the imagery for the item does not fill the entire space; since the bottom edges are currently specified as a scale value of 1, you can just add an offset value of -1 to give a pixel of spacing (obviously, this is just a little 'fake' since it's only visual. If you want a real physical space, you'll have to write your own listbox!)

CE.


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests