Cloning widget across multiple tabs

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

moorekevinw
Just popping in
Just popping in
Posts: 3
Joined: Sat Aug 18, 2012 01:30

Cloning widget across multiple tabs

Postby moorekevinw » Sat Aug 18, 2012 01:37

I have a menu that has a listbox that shows up on a few tabs, but not all of them.
Currently when the EventSelectionChanged event is fired on the listbox in either tab I grab the other one and update it to reflect the changes made in the first one.

What I would like is so that all of these listboxes are the same, however I haven't yet found any way to do this on the forums, or experimenting in my project.

Thanks,

Kevin

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Cloning widget across multiple tabs

Postby Kulik » Sat Aug 18, 2012 09:14

A group of 3 people on IRC can't figure out what you are on about. Please post your CEGUI.log, at least the mandatory section. Post images, provide better explanation.

We have some hunches what might be the problem but don't want to waste our time if the assumptions are incorrect.

moorekevinw
Just popping in
Just popping in
Posts: 3
Joined: Sat Aug 18, 2012 01:30

Re: Cloning widget across multiple tabs

Postby moorekevinw » Thu Aug 23, 2012 03:53

Sorry for not being more clear the first time.

Here is the essential part of my logs. The rest is just loading layout files and creating mappings (I can't see how that would be helpful)
22/08/2012 20:38:02 (Std) ---- Version 0.7.7 (Build: Jul 25 2012 Debug Microsoft Windows MSVC++ 10.0 32 bit) ----
22/08/2012 20:38:02 (Std) ---- Renderer module is: CEGUI::Direct3D9Renderer - Official Direct3D 9 based 2nd generation renderer module. ----
22/08/2012 20:38:02 (Std) ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
22/08/2012 20:38:02 (Std) ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
22/08/2012 20:38:02 (Std) ---- Scripting module is: None ----

Here are some images of two of the tabs in my application
http://i.imgur.com/NtZxy.png
http://i.imgur.com/BBfbn.png

The top half of those two tabs are the same. Currently what I'm doing is when I get an event from the GetFriends button on the first tab, I populate the listbox in both windows at once.
What I would like to be able to do (I'm not sure if this is possible) is to populate the first listbox and have the listbox on the other tab be updated as well.
Currently these two tabs are being created as Listboxes in two different layout files.

Code: Select all

    WindowManager::getSingleton().getWindow("SDKTestApp/Presence/GetFriends")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&UserDlg::GetFriends, this));
    WindowManager::getSingleton().getWindow("SDKTestApp/Friends/GetFriends")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&UserDlg::GetFriends, this));

void UserDlg::GetFriends()
{
Listbox* friendsListFriends = static_cast<Listbox*>(WindowManager::getSingleton().getWindow("SDKTestApp/Friends/FriendsList"));
Listbox* friendsListPresence = static_cast<Listbox*>(WindowManager::getSingleton().getWindow("SDKTestApp/Presence/FriendsList"));

for (int i = 0; i < numFriends; ++i)
{
friendsListFriends->addItem(friend[i]);
friendsListPresence->addItem(friend[i]);
}

...


The only things I've thought to try are having the same widget in both tabs, but that causes CEGUI to assert when two items are named the same thing when loading the layout files. I've also tried reassigning the first list box to the other.

Normally I wouldn't worry too much about this, but since I'm creating another tab that has some more of this information as well, I would like to reduce the amount of code that I'm copying around.

Thanks,

Kevin

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: Cloning widget across multiple tabs

Postby Kulik » Thu Aug 23, 2012 08:40

You can always detach and attach elsewhere and just have one widget doing this.

Or you can make it "always on top" and be independent of the tabs.

Synchronising 2 widgets is possible but AFAIK it needs custom code.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 11 guests