[ROOT] TGTextView problem

From: Adam Jon DeGrush (degrush@mit.edu)
Date: Wed Jan 23 2002 - 23:17:28 MET


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;
}



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:39 MET