Hi Glen, it is a timing problem due to the X server. The creation and popup generate two sets of events in the X11 event queue. Use on ProcessEvents() to handle those, then wait a short time and handle the second set of events. This second set will show the "Initializing" string. See below for code that works for me: Bool_t MainWindow::ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2) { TProgressMeter *meter = new TProgressMeter(fClient->GetRoot(),fClient->GetRoot()); meter->SetLabel("Initializing..."); fClient->ProcessEventsFor(meter); gSystem->Sleep(40); // <-- add fClient->ProcessEventsFor(meter); // <-- add gSystem->Sleep(2000); meter->SetLabel("Processing..."); ... } Cheers, Fons. "Glen R. Salo" wrote: > > Hi Fons, > > Thanks for your quick response. The new method > TGClient::ProcessEventsFor(TGWindow *w) works great with one exception as > illustrated in the attached code. Can you tell me why "Initializing..." > does not appear in the popup window? > > Thanks, > > Glen > > PS I compiled the code using the command: > > g++ -o progressmeter TProgressMeter.cxx `root-config --cflags` > `root-config --glibs` > > on a RedHat 7.1 Linux PC. > > On 03-Oct-2001 Fons Rademakers wrote: > > Hi Glen, > > > > I've implemented a new method TGClient::ProcessEventFor(TGWindow *w) > > that could be used instead of TSystem::ProcessEvents(). The code is in > > CVS. Please try and let me know if it works for you. > > > > Cheers, Fons. > > > > > > > > "Glen R. Salo" wrote: > >> > >> Hi ROOTERS, > >> > >> I have a main GUI which enables the user to perform operations which > >> can > >> take several seconds to complete. During these operations, I popup a > >> transient progress meter indicating how long they have to wait. In > >> order > >> to update the progress meter, I use gSystem->ProcessEvents() from a > >> method > >> inside the main GUI. This works okay, but it has limitations -- > >> specifically, it enables events in the main GUI. Is there a way I can > >> avoid this problem? The only solution I know is to create a separate > >> class which includes both the time consuming method as well as the > >> transient progress meter and then put the command > >> fClient->WaitFor(this) in > >> the transient progress meter class. I believe this will work, but I > >> would > >> prefer a general purpose progress meter which I could use whenever > >> there is > >> a time consuming process being executed by my main GUI. Does anyone > >> have a > >> suggestion? > >> > >> Thanks, > >> > >> Glen > > > > -- > > 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 > > -------------------------------------------------------------------------------- > Name: TProgressMeter.cxx > TProgressMeter.cxx Type: unspecified type (application/octet-stream) > Encoding: base64 > Description: TProgressMeter.cxx -- 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 : Tue Jan 01 2002 - 17:51:02 MET