Drawing a texbox in a pad

Hi RootTalk,
I am still a beginner with Root framework and have some good knowledge in C++.
My question is that I want to see a code of a text box within a pad I have divided in. Preferably using TGTextEdit.

My code:

[code] //draws lepto logo on pad 4, mid canvas of tc1
pad[4]->cd();
pad[4]->Divide(2, 1);
//left side of pad 4 is the logo
pad[4]->cd(1);
image.Draw(“X”);

//right side of pad 4 is the comment box
pad[4]->cd(2);
TGMainFrame         *fMain;
TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, 200, 40);

fMain = new TGMainFrame(gClient->GetRoot());
auto uGC = new TGGC(); //for textbox
TGFont *uFont;
uFont = gClient->GetFont("-*-helvectiva-medium-r-*-*-12-*-*-*-*-*-iso8859-1"); // for textbox
TGTextEdit *fTextEdit606 = new TGTextEdit(hframe, -1, uGC->GetGC(), uFont->GetFontStruct(), kSunkenFrame | kDoubleBorder | kOwnBackground);

hframe->AddFrame(fTextEdit606, new TGLayoutHints(kLHintsLeft | kLHintsTop, 2, 2, 2, 2));

[/code]

I would like to emphasis again, show me a code of a text box within a pad. This textbox is used for entering text and saving it. Please help me here, as I have been stuck in this for the past couple of days. Really appreciate any help.

Thanks,
Moj

[quote]Hi RootTalk,
… have some good knowledge in C++.
[/quote]

Hmmm, really? What about this then?

My code:

	TGMainFrame         *fMain;
	TGHorizontalFrame *hframe = new TGHorizontalFrame(fMain, 200, 40);

	fMain = new TGMainFrame(gClient->GetRoot());

I see some contradiction here!

Haha, okay it is hard to say what is good knowledge in C++. I think everyone’s opinion to what is good is different. But yes, my knowledge in C++ is not good but still in the beginner stage.

Can you not show me how to solve my problem? instead of judging me lol. I dont mean to be rude.
I may have taken your reply as a means to defend myself. Please lets not argue.

Wanted to say if it is possible to enable text box within a new instance of TCanvas? and if you can please show me.

thanks.

Hi Moj,

You cannot add a TGTextEntry (or TGTextEdit, or any other GUI element) in a TPad or a TCanvas, which are graphics containers, and not GUI containers. To use TGTextEdit, you have to create your own GUI. See the examples in $(ROOTSYS)/tutorials/gui

Cheers, Bertrand.

Thanks I forgot the tutorials are even there.

and here too: root.cern/doc/master/group__Tutorials.html