Jump to content

[SOLVED] Skin layout problem


photo

Recommended Posts

Hi?

I tested skin layout. but widgets in another container doesn't applied with new skin layout

Refer to screenshot, only 2 buttons downside applied by new skin layout.

How can I apply skin layout to all widgets?

Here is my code.

-------------

        auto gui = Gui::getCurrent();        
        gui->setSkinPath("../data/skin/");


        auto hbox = WidgetHBox::create();        
        gui->addChild(hbox);
        hbox->addChild(buttonAdd);
        hbox->addChild(buttonRemove);


        gui->addChild(buttonSave);
        gui->addChild(buttonJson);

s.jpg

Link to comment

Hello!

17 hours ago, dark99 said:

Hi?

I tested skin layout. but widgets in another container doesn't applied with new skin layout

Refer to screenshot, only 2 buttons downside applied by new skin layout.

How can I apply skin layout to all widgets?

Here is my code.

We would be happy to help you but unfortunately the code you sent is not enough for us to determine what is going wrong. Could you please provide us with a simple sample project so we can reproduce the issue on our end? You can do this by archiving the existing project folder created from SDK Browser and share it via any convenient way. Alternatively, you can export the used world with sources as a package as described in the following article in our documentation: https://developer.unigine.com/en/docs/2.18.1/editor2/managing_packages/?rlang=cpp#export_browser_assets

Thanks!

Link to comment

@dark99 Thank you for sharing this data with us! We will investigate it shortly and get back to you as soon as we have any information.

We hope this won't take long :)

Thanks!

Link to comment

It seems that you need to apply the skin first and create the widgets only after that. So, the proper order would be something like the following:

namespace TestPlay
{
	void Menu::Init()
	{

		auto gui = Gui::getCurrent();

		gui->setSkinPath("../data/skin/");	

		auto buttonAdd = WidgetButton::create("Add");
		buttonAdd->setLifetime(Widget::LIFETIME_WORLD);
		buttonAdd->setWidth(200);
		

		auto buttonRemove = WidgetButton::create("Remove");
		buttonRemove->setLifetime(Widget::LIFETIME_WORLD);
		buttonRemove->setWidth(200);
		

		auto buttonSave = WidgetButton::create("Save");
		buttonSave->setLifetime(Widget::LIFETIME_WORLD);
		buttonSave->setWidth(200);
		

		auto buttonJson = WidgetButton::create("Json");
		buttonJson->setLifetime(Widget::LIFETIME_WORLD);
		buttonJson->setWidth(200);

		auto hbox = WidgetHBox::create();
		
		gui->addChild(hbox);

		hbox->addChild(buttonAdd);
		hbox->addChild(buttonRemove);
		
		gui->addChild(buttonSave);
		gui->addChild(buttonJson);	

	}	
}

With this approach behavior proceeded as expected:

image.png

Thanks!

Link to comment
  • 2 weeks later...
  • bmyagkov changed the title to [SOLVED] Skin layout problem
×
×
  • Create New...