Re: [ROOT] TGTextView

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Fri Aug 11 2000 - 16:55:56 MEST


Hi Isidro,

   there was indeed a problem in the TGTextView::AddLine() code. I've fixed
this in the CVS version (so please use that).

Your AppendText() should look like:

void MyTextFrame::AppendText(const char* str){
   fTextView->AddLine(str);
   // scroll when needed to make last line visible
   if (fTextView->ToScrYCoord(fTextView->ReturnLineCount()) >
fTextView->GetHeight())
      fTextView->SetVsbPosition(fTextView->ReturnLineCount());
}


Cheers, Fons.



Isidro Gonzalez Caballero wrote:
> 
> Hi,
>         I am trying to build a window where to redirect the standard
> output. So, I constructed a new class in which I included a TGTextView.
> Whenever something is writen to a special output buffer, it forwards the
> message to this TGTextView with code like:
> 
> void MyTextFrame::AppendText(const char* str){
>   fTextView->AddLine(str);
>   //Do I need the following line. It is never clear when it should be
>   //called
>   fClient->NeedRedraw(fTextView);
> }
> 
> The problem is that this does nothing!... The only way to make it work is
> having something like:
> 
> void MyTextFrame::AppendText(const char* str){
>   //fText is a TString
>   fText += str;
>   fTextView->LoadBuffer(fText);
>   //Do I need the following line. It is never clear when it should be
>   //called
>   fClient->NeedRedraw(fTextView);
> }
> 
> But this slows down the program when the output is big, and always places
> the scroll bar at the begining. I am compiling with:
> 
> ROOT Version   2.25/01     9 August 2000
> CINT/ROOT C/C++ Interpreter version 5.14.44, Jul 18 2000
> Linux RH 6.1
> 
> Any ideas on making this work properly. Thank you very much:
> 
>                 Isidro
> 
> +---------------------------+--------------------------------+
> | Isidro González Caballero | mailto:Isidro.Gonzalez@cern.ch |
> | CERN-EP / Mailbox: F28010 | http://home.cern.ch/~iglez/    |
> | 1211 Geneva 23            |               -o-              |
> | Switzerland               | Tel: +41 22 76 73060, 73316    |
> +---------------------------+--------------------------------+

-- 
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 7677910



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:31 MET