Hi Adam,
have a look at:
http://root.cern.ch/root/roottalk/roottalk00/2293.html
Let me know if this does not work for you.
Cheers, Fons.
On Wed, 2002-01-23 at 23:17, Adam Jon DeGrush wrote:
>
> Hello Rooters,
>
> I wanted to redirect console out in my gui to a TGTextView but for
> some reason it is created with a grey background, the text doesn't show
> up(even though ReturnLineCount() returns an ever increasing number), and
> when a scroll bar appears it has nothing for the mouse to grab on to.
>
>
> I am running root 3.02/00 and rh 7.0
> Thanks,
> Adam DeGrush
>
> Basically the code looks like this:
>
> class MyMainFrame : public TGMainFrame {
>
>
> MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
> : TGMainFrame(p, w, h)
> {
> fButton1 = new TGTextButton(CompositeFr1, "Write text", 1);
> fButton1->Associate(this);
> CompositeFr1->AddFrame(fButton1, layhint1);
> AddFrame(CompositeFr1,layhint2);
> tV1 = new TGTextView(CompositeFr2,300,300,-1,
> kSunkenFrame | kDoubleBorder, GetWhitePixel());
> tV1->Associate(this);
> AddFrame(CompositeFr2, layhint2);
> MapSubwindows();
> SetWindowName("Writing Text");
> SetIconName("Writing Text");
> MapWindow();
> }
>
> Bool_t MyMainFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t){
>
> ....
> if (parm1 ==1)
> const char *mystring = "This should be written";
> tV1->AddLine(mystring);
> fClient->NeedRedraw(tV1);
> cout <<"total # of lines = "<<
> tV1->ReturnLineCount()<<endl;
> }
> }
>
> int main(int argc, char **argv)
> {
> TApplication theApp("App", &argc, argv);
> MyMainFrame mainWin(gClient->GetRoot(), 400, 250);
> theApp.Run();
> return 0;
> }
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:40 MET