hworld2.cxx

Go to the documentation of this file.
00001 // @(#)root/test:$Id: hworld2.cxx 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Fons Rademakers   04/04/97
00003 
00004 // This small demo shows the traditional "Hello World". Its main use is
00005 // to show how to use ROOT graphics and how to enter the eventloop to
00006 // be able to interact with the graphics.
00007 
00008 #include "TApplication.h"
00009 #include "TCanvas.h"
00010 #include "TLine.h"
00011 #include "TPaveLabel.h"
00012 
00013 int main(int argc, char **argv)
00014 {
00015    TApplication theApp("App", &argc, argv);
00016 
00017    TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);
00018 
00019    TPaveLabel *hello = new TPaveLabel(0.2,0.4,0.8,0.6,"Hello World");
00020    hello->Draw();
00021    TPaveLabel *quit = new TPaveLabel(0.2,0.2,0.8,0.3,"Close via menu File/Quit");
00022    quit->Draw();
00023    c->Update();
00024 
00025    // Enter event loop, one can now interact with the objects in
00026    // the canvas. Select "Exit ROOT" from Canvas "File" menu to exit
00027    // the event loop and execute the next statements.
00028    theApp.Run(kTRUE);
00029 
00030    TLine *l = new TLine(0.1,0.2,0.5,0.9);
00031    l->Draw();
00032    quit->SetLabel("Select File/Quit again to exit app");
00033    c->Update();
00034 
00035    // Here we don't return from the eventloop. "Exit ROOT" will quit the app.
00036    theApp.Run();
00037 
00038    return 0;
00039 }

Generated on Tue Jul 5 15:15:03 2011 for ROOT_528-00b_version by  doxygen 1.5.1