getSubWidgetMain() Problem

kevinmore

24-03-2013 17:39:42

Hi,

I'm writing a function to generate a spline according to the data set. So I copy and pasted the Unit_Test_Spline demo. My code is like below:

//create an instance first
MyGUI::VectorWidgetPtr widgets = MyGUI::LayoutManager::getInstance().loadLayout("SplineWindow.layout");
MyGUI::ScrollBar* qualityScroll = widgets.at(0)->findWidget("SplineQuality")->castType<MyGUI::ScrollBar>();
mClient = widgets.at(0)->findWidget("SplineClient");

// create widget with skin that contain specific sub skin - PolygonalSkin
MyGUI::Widget* widget = mClient->createWidget<MyGUI::Widget>("PolygonalSkin", MyGUI::IntCoord(MyGUI::IntPoint(), mClient->getSize()), MyGUI::Align::Stretch);
widget->setColour(MyGUI::Colour::Red);
// get main subskin
MyGUI::ISubWidget* main = widget->getSubWidgetMain();
mPolygonalSkin = main->castType<MyGUI::PolygonalSkin>();


But the getSubWidgetMain() function doesn't seem to work in my project. Can anyone explain that?

Thanks!

kevinmore

24-03-2013 21:28:56

OK, I figured it out. The polygonalSkin is not defined by default. Need to add this line first.

MyGUI::ResourceManager::getInstance().load("FrameworkSkin.xml");