Ah, it's a sub-class. Somehow I mistook it for a derived class...CGUIEmptyElement is a sub-class of IGUIElement,
thanks for the code examples, and for the help in general. I think I should get it rolling now.
Code: Select all
CGUIEmptyElement * myRootElement = new CGUIEmptyElement(environment, environment->getRootGUIElement() );
I actually started doing something along those lines this morning, until I understood what your empty element actually does. As It seems a much more convenient way I abandoned that undertaking.Also you don't _need_ the CGUIEmptyElement object, there are also other solutions to do the same. For example you can save a pointer to _every_ gui-element which you use in one screen and then call setVisible for all of them.
Code: Select all
//first, creating the element and the pointer and setting the size of the element to the whole screen as per your advice:
CGUIEmptyElement SystemMapGUI(mGUI, 0);
IGUIElement* SystemMapGUIPtr = (IGUIElement*)(&SystemMapGUI);
SystemMapGUI.setRelativePosition( core::rect<s32>(0,0,ScreenRes.X,ScreenRes.Y));
//then I add a table to it
gui::IGUITable *SolarTable = mGUI->addTable(core::rect<s32>(ScreenRes.X * 0.03, 300, ScreenRes.X - ScreenRes.X * 0.03,502), SystemMapGUIPtr);
SolarTable->addColumn(L"", 0);
SolarTable->addColumn(L"", 1);
SolarTable->setColumnWidth(0, SolarTable->getAbsoluteClippingRect().getWidth() / 2);
SolarTable->setColumnWidth(1, SolarTable->getAbsoluteClippingRect().getWidth() / 2);
SolarTable->addRow(0);
SolarTable->addRow(1);
SolarTable->addRow(2);
SolarTable->addRow(3);
SolarTable->addRow(4);
SolarTable->addRow(5);
SolarTable->addRow(6);
SolarTable->addRow(7);
SolarTable->addRow(8);
//Finally I call bringToFront and draw the environment, I do this last in the draw loop:
SystemMapGUI.bringToFront(SystemMapGUIPtr);
device->getGUIEnvironment()->drawAll();
Code: Select all
IGUIElement* SystemMapGUIPtr = new CGUIEmptyElement( mGUI, mGUI->getRootGUIElement() );
Code: Select all
core::list<gui::IGUIElement*> myTables;
myTables = myGUI->getChildren();
for(core::list<gui::IGUIElement*>::Iterator it = myTables.begin(); it != myTables.end(); ++it)
{
(*it)->setCellText(0,1, std::wstring(Sun.Name.begin(), Sun.Name.end()).c_str());
}
yes, do a cast...UncleBob wrote:Is there a way to get a pointer of type IGUITable so I can edit my tables?
Code: Select all
(IGUITable*(*it))->setCellText(0,1, std::wstring(Sun.Name.begin(), Sun.Name.end()).c_str());
Code: Select all
((IGUITable*)(*it))->setCellText(0,1, std::wstring(Sun.Name.begin(), Sun.Name.end()).c_str());
Code: Select all
IGUITable* tbl = (IGUITable*)*it;
tbl->setCellText(0,1, std::wstring(Sun.Name.begin(), Sun.Name.end()).c_str());