Page 1 of 1

Radiobuttons using multiple LookNFeel graphics

Posted: Tue Apr 13, 2010 17:05
by paperpusher
I am trying to make a bunch of windows that will all look different, but be members of the same group. I tried to do the following, but the individual windows were operating as if they were the memebers of their own group, and not "working together":

Code: Select all

CEGUI::RadioButton* bTest = (CEGUI::RadioButton *)CEGUI::WindowManager::getSingleton().createWindow( "MyLook/Checkbox_A", "cmdTest" );
bTest->setGroupID(1);
bTest->setPosition(UVector2(UDim(0.3f, 0), UDim(0.2f, 0)));
bTest->setSize(UVector2(UDim(0.153f, 0), UDim(0.225f, 0)));
pLayout->addChildWindow(bTest);

CEGUI::RadioButton* bTest2 = (CEGUI::RadioButton *)CEGUI::WindowManager::getSingleton().createWindow( "MyLook/Checkbox_B", "cmdTest2" );
bTest2->setGroupID(1);
bTest2->setPosition(UVector2(UDim(0.5f, 0), UDim(0.2f, 0)));
bTest2->setSize(UVector2(UDim(0.153f, 0), UDim(0.225f, 0)));
pLayout->addChildWindow(bTest2);

CEGUI::RadioButton* bTest3 = (CEGUI::RadioButton *)CEGUI::WindowManager::getSingleton().createWindow( "MyLook/Checkbox_C", "cmdTest3" );
bTest3->setGroupID(1);
bTest3->setPosition(UVector2(UDim(0.7f, 0), UDim(0.2f, 0)));
bTest3->setSize(UVector2(UDim(0.153f, 0), UDim(0.225f, 0)));
pLayout->addChildWindow(bTest3);


As you can see from the above code, my original thought was to use checkboxes and then use code to link them as radiobuttons. The reason I stopped that course of logic was that I could not determine a good way to tell the listener which checkbox was checked. I will have a dynamic number of radiobuttons so I need the event listener to be the same for all the buttons. This listener will then perform the correct action based on which button made the call.

If different looking radio buttons cannot be members of the same group, how do you tell a checkbox event listener what checkbox is being used?

Re: Radiobuttons using multiple LookNFeel graphics

Posted: Thu Apr 15, 2010 08:39
by CrazyEddie
You should have posted your log, then I wouldn't have had to ask the following question (are you guys catching on to this yet?! :))

What is the target type that the types "MyLook/Checkbox_*" are mapped to? The fact it says checkbox in the type name leads me to assume it's CEGUI/Checkbox, which means you can't cast to CEGUI::RadioButton and have any kind of success ;) If this is the case, you need to ensure that the radio buttons really are radio buttons and not check boxes.

CE.