Jump to content

[SOLVED] Dynamlicy add or remove custom widgets to an ui


photo

Recommended Posts

Hello Community,

 

i have a little problem, the most is said in the topic-title, but here a little longer explanations:

First i want to load a defined gui: engine.gui.addUserInterface ( engine.getGui(), "myGui.ui" );

After this, i do: Gui gui = engine.getGui();

Now my gui is visible.

 

And now my problems begins: I have a Button called "Add a Tab", with this i want to change the myGui.ui, and add a new Tab dynamic to the .ui, of course i want to remove a tab again too, this needs to be dynamlicy, so i could add more then one tab, and remove more then one tab.

The second thing is, when i added a dynamic tab, i want to input some buttons into the tab too. (Maybe this both things needs to be added together, i dont know?)

 

I've searched the API and https://developer.unigine.com/docs but i didnt find anything.

Is there any point to help me?

 

Maybe someone have a example to me, how to do this?

 

Greetings

Link to comment

Hey Ulf, thanks for this fast reply!

 

Yä, this works, to insert a new tab, thanks thanks thanks!

 

But problem 2 is not solved with the add or remove tab solution, because i need now to get content in my added tab too, with mainTabBox.addchild etc. my application crash's.

Is there a way to load a UserInterface into the created tab, like "addUserInterface()" or how could this be managed?

Not just text should be shown in the created tab: buttons, checkboxes etc. too, which should have callback's too, and can be mananaged in code?

 

Thanks a lot for any help!

Link to comment

Have a look into data/core/editor sub-directory for samples of WidgetTabBox usage (search for files *.h containing WidgetTabBox via Windows Explorer or similar search tool). There should be some examples how to dynamically define callbacks, child elements etc.

 

post-82-0-70113900-1324219243_thumb.jpg

Link to comment
×
×
  • Create New...