Page 1 of 1

Cloning widget across multiple tabs

Posted: Sat Aug 18, 2012 01:37
by moorekevinw
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

Re: Cloning widget across multiple tabs

Posted: Sat Aug 18, 2012 09:14
by Kulik
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.

Re: Cloning widget across multiple tabs

Posted: Thu Aug 23, 2012 03:53
by moorekevinw
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

Re: Cloning widget across multiple tabs

Posted: Thu Aug 23, 2012 08:40
by Kulik
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.