Page 1 of 1

RadioButton with Ogre

Posted: Fri Jul 28, 2006 12:28
by alejo_cadavid
Hi...

I searched some help and coded that:

Code: Select all

CEGUI::RadioButton* sombra1;
CEGUI::RadioButton* sombra2;
sombra1 = (CEGUI::RadioButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/RadioButton", "S1");
      sombra1->setGroupID(1);
      sombra1->setID(101);
      sombra1->setSelected(true);
      sombra2 = (CEGUI::RadioButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/RadioButton", "S2");
      sombra2->setGroupID(1);
      sombra2->setID(102);
      sombra2->setSelected(false);


But doesn't work...

How should i create a RadioButton?

Thanks

Posted: Fri Jul 28, 2006 13:22
by Rackle
Probably need to provide a position and a dimension. WidgetGalore uses a .layout file which specifies those attributes. If you wish to create widgets via code you should look at the Cegui samples; I think sample #7 might contain what you are looking for.

RadioButton with Ogre

Posted: Fri Jul 28, 2006 22:53
by alejo_cadavid
Thank you so much Rackle..

I created a member crearRadioBoton and works now...

Code: Select all

//metodo para crear un radio boton
   void crearRadioBoton(CEGUI::RadioButton** id, CEGUI::UVector2 P, CEGUI::Size S, CEGUI::String texto, bool EN, bool seleccion, int Grupo, int ID)
   {   //creacion de objeto Radio boton
      *id = (CEGUI::RadioButton*)CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/RadioButton", texto);
      //se agrega el boton a la ventana padre de CEGUI
      mEditorGuiSheet->addChildWindow(*id);
      //posicion de boton
      (*id)->setWindowPosition(P);
      //tamaƱo de boton
      (*id)->setSize(S);
      //texto en boton
      (*id)->setText(texto);
      //id de grupo
      (*id)->setGroupID(Grupo);
      //id de boton en el grupo
      (*id)->setID(ID);
      //seleccion inicial
      (*id)->setSelected(seleccion);
      //vsibilidad
      (*id)->setVisible(EN);
   }