Page 1 of 1

Interface approach recommendation

Posted: Sun Mar 04, 2007 13:40
by Rackle
Taken from the Ogre message board, Protagonist wrote:
I'm using CEGUI 0.5, and am trying to make an interface strip at the bottom of my render window, containing some Editboxes, and buttons.



I would create a DefaultWindow with a left of 0.0, right of 1.0, top of 0.8, and bottom of 1.0 and set the "TextColours" property to result in the color of your choice. Have a look at the StaticText entry within Widget Galore to see what I mean. This takes care of your "strip".

Then add the other widgets as children of that strip. Look at the StaticText entry within WidgetGalore for the labels, the Editbox, and the Button. For the vertical lines/separators I would use a StaticImage.

Hope this was helpful.

Posted: Sun Mar 04, 2007 14:26
by Protagonist
Ahh, thanks!


But it says:
"The StaticText is now defunct and has been replaced by the DefaultWindow. "

I tried to create an edit box like so:

Code: Select all

   CEGUI::Editbox* entryATB = (CEGUI::Editbox*)winMgr.createWindow("WindowsLook/Editbox");
   mGUISheet->addChildWindow(entryATB);
   entryATB->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0.9, 0)));
   entryATB->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(0.1, 0))); //full width, 10% height
   entryATB->setEnabled(true);


But I get the following error:

Code: Select all

error C2664: 'void CEGUI::Window::addChildWindow(const CEGUI::String &)' : cannot convert parameter 1 from 'CEGUI::Editbox *' to 'const CEGUI::String &'



But my button code as follows does work:

Code: Select all

   CEGUI::PushButton* okInterval = (CEGUI::PushButton*)winMgr.createWindow("WindowsLook/Button", (CEGUI::utf8*)"okInterval");
   mGUISheet->addChildWindow(okInterval);
   //bottomBar->addChildWindow(okATBButton);
   okInterval->setPosition(CEGUI::UVector2(CEGUI::UDim(0.93, 0), CEGUI::UDim(0.92, 0)));
   okInterval->setSize(CEGUI::UVector2(CEGUI::UDim(0.05, 0), CEGUI::UDim(0.06, 0)));
   okInterval->setText("OK");
   okInterval->setEnabled(true);


When I type CEGUI:: the drop down list of options (sorry, forgot the name), lists PushButton, and combobox etc, but not Editbox. Could that be the problem?

Thanks again

Posted: Mon Mar 05, 2007 10:42
by Rackle
Protagonist wrote:But it says:
"The StaticText is now defunct and has been replaced by the DefaultWindow. "


Yup, they (StaticImage and StaticText) are no longer supported as separate classes but their concept still remains. If you want to display text use a DefaultWindow with the parameters mentioned in the StaticText section of WidgetGalore and if you want to display an image you can use the parameters mentioned in the StaticImage section. The first paragraph in WidgetGalore may make it seem like the second paragraph is obsolete but that is not the case.

As mentioned in the other thread, using the LayoutEditor is the easiest way to design an interface. However what you have so far is almost correct. I think the solution is to cast to a (CEGUI::Window*). Type the opening parenthesis of addChildWindow() and then you can scroll through the various types of parameters.

Posted: Mon Mar 05, 2007 21:18
by Protagonist
That's so weird, your right, this works, if that's what you meant:

Code: Select all

   CEGUI::Window* entryATB = (CEGUI::Window*)winMgr.createWindow("WindowsLook/Editbox", "BottomBar/entryATB");
   bottomBar->addChildWindow(entryATB);
   entryATB->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.25, 0)));
   entryATB->setSize(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.5, 0)));
   entryATB->setEnabled(true);


Instead of:

Code: Select all

CEGUI::Editbox* entryATB = (CEGUI::Editbox*)winMgr.createWindow("WindowsLook/Editbox");


which didn't work.
It's as if Editbox is like statictext and staticimage, and has been obsorbed into the default window class.
I also find the default window strange, because I can't create anything of type defaultwindow, it must be window instead.

Hmm.