[ROOT] TGTextView

From: Isidro.Gonzalez.Caballero@cern.ch
Date: Thu Aug 01 2002 - 16:52:05 MEST


Hi,
	I have a TGTextView widget where I would like to print some help. 
The width is fixed by the width of the frame where it is included, but the
height may vary since there are other widgets below whose number and type
change as the text on the TGTextView changes... I would like the
TGTextView widget to have a size so that all the text inside fits on it
without the need of a vertical scroll-bar. I don't mind having an
horizontal one (though the possibility to allow lines to wrap would also
be nice).

The code I use now is something like the following:

void G4RootCommandFrame::AddGuidance(const char* guidance) {

  //fGuidance is the TGTextView widget
  if (!fGuidance) {
    fGuidance = new TGTextView(this, 300, 100);
    AddFrame(fGuidance, fWidgetLayout);
  }
  
  fGuidance->AddLine(guidance);
  fGuidance->SetHeight(fGuidance->ReturnHeighestColHeight()+10);
  //10 is a guess... as well as ReturnHeighestColHeight

  //fGuidance->AdjustWidth(); is this needed???
}

This is called once for each line added to the TGTextView. And it works
well if no line is longer that the widget width. On the other hand, a top
blank space of the size of a line is left. Any ideas of which will the
appropiate height for the TGTextView?

	Thanks,

		Isidro

PS.: How is it going my suggestion on 
http://root.cern.ch/root/roottalk/roottalk02/1803.html?

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



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