[ROOT] TGListBox - advice would be greatly appreciated

From: Mark Thomson (thomson@hep.phy.cam.ac.uk)
Date: Sat Aug 11 2001 - 18:50:53 MEST


Dear Rooters,

I've written a simple GUI application to display logging messages based on
the TGListBox class. On the whole things work fine. However I have a problem 
which causes the screen updates to be rather jittery:

  1) How do I force the window to redraw immediately after I add a
     new entry. I had expected the new TGTextLBEntry to be drawn 
     immediately after the code (see below) has been executed - it
     doesn't.

     What am I doing wrong  ? How do I force the listbox and entry to be
     drawn after adding each TGTextLBEntry.

		cheers,
                       Mark Thomson


  // Make the new entry - associate it with the LB container
  TGTextLBEntry* pLBT2 = new TGTextLBEntry(fListBox->GetContainer(),
                                    pString,++_iListBoxEntry,
                                    theGC, theFont,
  			 	    kHorizontalFrame,backColor);
  TGLayoutHints* fLayout = new TGLayoutHints(kLHintsLeft|kLHintsTop|kLHintsExpandX, 
                                    1, 0, 0, 1 );

  // NOTE the list box adopts pLBT2 and fLayout
  // Add the entry and try to display it
  fListBox->AddEntry(pLBT2,fLayout);
  fListBox->MapSubwindows();
  fListBox->Layout();
  // Scroll so that new entry is at the bottom of the screen 
  int nThatFit = fListBox->GetHeight()/(pLBT2->GetHeight()+
                       fLayout->GetPadTop()+fLayout->GetPadBottom());

  if(_iListBoxEntry>nThatFit)fListBox->SetTopEntry(_iListBoxEntry+1-nThatFit);



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET