Hi, I want to build a contolbar with buttons to launch several macros and to also set some global variables (number of events, center of mass energy, target material,...). I would like to get the values for this variables through a dialog box, but I don't know an easy way to do it (suggestions?). I decided then to get the information from the standard input, but then I get no echo. I have attached a small macro showing it (just click in the "# Events" button and try to type anything). Any solutions? Cheers, Isidro +---------------------------+--------------------------------+ | 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 | +---------------------------+--------------------------------+ ////////////////////////////////////////////// // Class to hold event data information. Works // like a store of global variables class EventData { public: EventData(){ nEvents = -1; cout << "* Creating EventData with default values." << endl; } static void SetNEvents(Int_t n) { nEvents=n; } static Int_t GetNEvents() {return nEvents;} static void Dump() { cout << "* EventData values:" << endl; cout << "\t- NEvents = " << nEvents << endl; } protected: static Int_t nEvents; }; /////////////////////////////////////////// // Get from normal input the number of events // to be processed. void FindNEvents() { Int_t nev; cout << endl << "*******************************************************************" << endl; cout << "Input number of events to be processed (-1 for ALL): " << endl; cin >> nev; cout << "*******************************************************************" << endl; EventData::SetNEvents(nev); EventData::Dump(); } /////////////////////////////////////////// // Build Control bar void Trial() { EventData* d = new EventData; d->Dump(); gROOT->Reset(); TControlBar* bar = new TControlBar("vertical", "Tools"); bar->AddButton("ROOT Browser", "new TBrowser;", "Start the ROOT Browser"); bar->AddButton("# Events", "FindNEvents();", "Set the number of events to be processed"); bar->Show(); }
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:04 MET