Hi Christian,
I have a macro in which I am using gClient->ProcessEventsFor(TGWindow
*w)
method instead of ProcessEvents and it works. Here are the lines of
code:
TGFrameElement *f;
TIter next(fMain->GetList()); //fMain is a main frame
while ((f = (TGFrameElement *)next())) {
sprintf(buf, " Frame <%s>...",f->fFrame->GetName());
fStatusBar->SetText(buf, 0);
gClient->ProcessEventsFor(fStatusBar);
gSystem->Sleep(600); //just to see the text into the status
bar
}
Best regards, Ilka
cstrato wrote:
> Dear Rooters
>
> In a while-loop I am importing data and want to display
> the data names in the statusbar of my GUI-app.
> Sorrowly, only the last message is displayed when the
> while-loop finishes.
>
> Do you know what I have to do so that the text is
> displayed in the statusbar whenever I call:
> fStatusBar->SetText(text,0)?
>
> My code looks like this:
>
> class AppFrame {
> RQ_OBJECT("AppFrame")
>
> private:
> TGMainFrame *fMain;
> TGStatusBar *fStatusBar;
>
> public:
> AppFrame() {}
> AppFrame(const TGWindow *window, UInt_t w, UInt_t h);
> virtual AppFrame();
>
> void SetStatusBarText(const char *text, Int_t partidx)
> {fStatusBar->SetText(text, partidx);}
>
> ClassDef(AppFrame,0)
> };
>
> class DataFrame {
> RQ_OBJECT("DataFrame")
>
> private:
> AppFrame *fAppFrame;
> TGCompositeFrame *fParentFrame;
>
> public:
> DataFrame() {}
> DataFrame(TGCompositeFrame *parent, AppFrame *main, UInt_t w,
> UInt_t h);
> virtual ~DataFrame();
>
> void DoImportData();
>
> ClassDef(DataFrame,0)
> };
>
> void DataFrame::DoImportData()
> {
> char buf[256];
> // Import data
> TIter next(mylist);
> MyData *data = 0;
> while ((data = (MyData*)next())) {
> TString name = data->GetName();
>
> // display current status
> gSystem->Sleep(4000);//test only
> gSystem->ProcessEvents(); // handle GUI events??
> sprintf(buf, "Importing file <%s>...", name.Data());
> fAppFrame->SetStatusBarText(buf, 0);
>
> class->Import(name.Data());
> }//while
>
> // Close file
> TString datafile = class->GetFile()->GetName();
> sprintf(buf, "Data import finished, closing file <%s>...",
> datafile.Data());
> fAppFrame->SetStatusBarText(buf, 0);
> class->Close();
> fAppFrame->SetStatusBarText("Ready...", 0);
> }//DoImportData
>
> Thank you in advance
> Best regards
> Christian
> _._._._._._._._._._._._._._._._
> C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
> V.i.e.n.n.a A.u.s.t.r.i.a
> _._._._._._._._._._._._._._._._
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET