Save using ROOT GUI Builder as a class instead of function

Hello, i used ROOT GUI Builder to make a software. I want to keep the gui.cpp file as made by ROOT GUI Builder to allow following edits but I want to implement other part of the gui in another cpp file (slots, edit the UI)…

How can I access elements made inside gui() from the main() function in a compact way?

My first idea, that unfortunately requires a gui.cpp modification, is to modify the method in a class:

class gui{
	TGComboBox * S_com;
	S_com = new TGComboBox(fHorizontalFrame709, -1, kHorizontalFrame | kSunkenFrame | kOwnBackground, ucolor);

keeping all elements as public so in the main i can replace gui(); to gui g; and calling methods like g.S_com->AddEntry("asd", 0);

Isn’t possible to save the gui.cpp directly as a class? Is there a better way to access objects keeping name shorts?



No, it is not possible to save as class(es), and there is no plan to change the current behavior…

Cheers, Bertrand.

Thank you,

Is there a way to access gui() items without changing the gui.cpp?

You mean the objects declared inside the function? No, they are only accessible from inside the function (scope) where they are defined. But why don’t you want to modify the code? You should anyway, since the layout is broken when generating it with the gui builder…

I want to keep the file untouched to not preclude the possibility to add other parts of UI directly with gui builder.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.