Fork me on GitHub

Ignore:
Timestamp:
Nov 6, 2014, 10:58:31 AM (10 years ago)
Author:
Christophe Delaere <christophe.delaere@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
53b78e8
Parents:
6301e02
Message:

Use signal/slot to communicate with GUI elements

This removes the need to keep pointers to widgets in the class itself.
Next: do something similar to communicate the progress of the summary
plot initialization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • display/DelphesEventDisplay.cc

    r6301e02 r0a67548  
    7373   delete chain_;
    7474}
     75
     76void DelphesEventDisplay::EventChanged(Int_t e)
     77{
     78  if( e!= event_id_ ) {
     79    event_id_ = e;
     80    Emit("EventChanged(Int_t)",e);
     81    load_event();
     82  }
     83}
     84
    7585
    7686DelphesEventDisplay::DelphesEventDisplay(const char *configFile, const char *inputFile, Delphes3DGeometry& det3D)
     
    370380        b->Connect("Clicked()", "DelphesEventDisplay", this, "Bck()");
    371381
    372         numberEntry_ = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
    373         hf->AddFrame(numberEntry_, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10));
    374         numberEntry_->Connect("ValueSet(Long_t)", "DelphesEventDisplay", this, "GoTo(Long_t)");
     382        TGNumberEntry* numberEntry = new TGNumberEntry(hf,0,9,-1,TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative, TGNumberFormat::kNELLimitMinMax, 0, treeReader_->GetEntries());
     383        hf->AddFrame(numberEntry, new TGLayoutHints(kLHintsCenterX | kLHintsCenterY , 2, 0, 10, 10));
     384        this->Connect("EventChanged(Int_t)","TGNumberEntry",numberEntry,"SetIntNumber(Long_t)");
     385        numberEntry->GetNumberEntry()->Connect("TextChanged(char*)", "DelphesEventDisplay", this, "PreSetEv(char*)");
     386        numberEntry->GetNumberEntry()->Connect("ReturnPressed()", "DelphesEventDisplay", this, "GoTo()");
    375387       
    376388        b = new TGPictureButton(hf, gClient->GetPicture(icondir+"GoForward.gif"));
     
    381393     vf->AddFrame(hf, new TGLayoutHints(kLHintsExpandX , 2, 2, 2, 2));
    382394
    383      progress_ = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
    384      progress_->SetMax( treeReader_->GetEntries());
    385      progress_->ShowPosition(kTRUE, kFALSE, "Event %.0f");
    386      progress_->SetBarColor("green");
    387      vf->AddFrame(progress_, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5));
     395     TGHProgressBar* progress = new TGHProgressBar(frmMain, TGProgressBar::kFancy, 100);
     396     progress->SetMax( treeReader_->GetEntries());
     397     progress->ShowPosition(kTRUE, kFALSE, "Event %.0f");
     398     progress->SetBarColor("green");
     399     vf->AddFrame(progress, new TGLayoutHints(kLHintsExpandX, 10, 10, 5, 5));
     400     this->Connect("EventChanged(Int_t)","TGHProgressBar",progress,"SetPosition(Float_t)");
    388401   }
    389402   frmMain->AddFrame(vf, new TGLayoutHints(kLHintsExpandX , 5, 5, 5, 5));
Note: See TracChangeset for help on using the changeset viewer.