Re: [ROOT] gui question

From: Valeriy Onuchin (Valeri.Onoutchine@cern.ch)
Date: Tue Dec 14 2004 - 13:27:46 MET


Hi Boris,
please, check http://root.cern.ch/phpBB2/viewtopic.php?t=1242
Check also $ROOTSYS/test/guiviewer.cxx

Regards. Valeriy

> Dear Rooters,
> 
> I am based on example guitest.C provided with root 4-00-08f version.
> I was trying to compile three files which I attached to this letter with 
> the next command:
> 
> g++ `root-config --cflags --glibs` -o main main.cxx MyMain.cxx
> 
> I got the next linking error:
> 
> /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../crt1.o(.text+0x18): In 
> function `_start':
> ../sysdeps/i386/elf/start.S:77: undefined reference to `main'
> collect2: ld returned 1 exit status
> 
> Maybe this error not connected with root itself, if so, sorry for the 
> question that should not be addressed in roottalk.
> 
> Thank you very much,
> Boris.
> 
> 
> -- 
> ------------------------------------------------
> |  Boris Skorodumov, 
> |  Graduate Student, Physics Department,
> |  University of Notre Dame,
> |  Notre Dame, IN 46556, USA
> |  WWW:   www.nd.edu/~bskorodo
> ------------------------------------------------
> 
> 


--------------------------------------------------------------------------------


> #include "MyMain.h"
> 
> const char *nlabel[] = {
>    "Up",
>    "Down",
>    "Left",
>    "Right",
> };
> 
> const Double_t ninit[] = {5,8,10,21};
> 
> 
> MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
> {
>    fMain = new TGMainFrame(p, w, h);
>    fMain->Connect("CloseWindow()", "MyMainFrame", this, "CloseWindow()");
>     
>    fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
>    fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
>    fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
>    
>    fMenuFile = new TGPopupMenu(gClient->GetRoot());
>    fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
>    fMenuFile->AddEntry("&Save", M_FILE_SAVE);
>    fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
>    fMenuFile->AddEntry("&Close", -1);
>    fMenuFile->AddSeparator();
>    fMenuFile->AddEntry("&Print", M_FILE_PRINT);
>    fMenuFile->AddEntry("P&rint setup...", M_FILE_PRINTSETUP);
>    fMenuFile->AddSeparator();
>    fMenuFile->AddEntry("E&xit", M_FILE_EXIT);
> 
>    fMenuFile->DisableEntry(M_FILE_SAVEAS);
>    fMenuFile->HideEntry(M_FILE_PRINT);
>    
>    
>    fMenuTest = new TGPopupMenu(gClient->GetRoot());
>    fMenuTest->AddLabel("Test different features...");
>    fMenuTest->AddSeparator();
>    fMenuTest->AddEntry("&Dialog...", M_TEST_DLG);
>    fMenuTest->AddEntry("&Message Box...", M_TEST_MSGBOX);
>    fMenuTest->AddEntry("&Sliders...", M_TEST_SLIDER);
>    fMenuTest->AddEntry("Sh&utter...", M_TEST_SHUTTER);
>    fMenuTest->AddEntry("&List Directory...", M_TEST_DIRLIST);
>    fMenuTest->AddEntry("&File List...", M_TEST_FILELIST);
>    fMenuTest->AddEntry("&Progress...", M_TEST_PROGRESS);
>    fMenuTest->AddEntry("&Number Entry...", M_TEST_NUMBERENTRY);
>    
>    fMenuHelp = new TGPopupMenu(gClient->GetRoot());
>    fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
>    fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
>    fMenuHelp->AddSeparator();
>    fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
>    
>    
>    fMenuFile->Connect("Activated(Int_t)", "TestMainFrame", this,
>                      "HandleMenu(Int_t)");
>    fMenuView->Connect("Activated(Int_t)", "TestMainFrame", this,
>                      "HandleMenu(Int_t)");
>    fMenuHelp->Connect("Activated(Int_t)", "TestMainFrame", this,
>                       "HandleMenu(Int_t)");
>    
>    fF1 = new TGVerticalFrame(fMain, 200, 300);
>   
>    fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2);
>    
>    fMain ->AddFrame(fF1, fL1);
>    
>    fHor1 = new TGHorizontalFrame(fF1, 200, 30);
>    fF1->AddFrame(fHor1, fL1);
>    fCheck  = new TGCheckButton(fHor1, "PSD Detector", 4);
>    fHor1->AddFrame(fCheck, fL1);
>    
>    for (int i = 0; i < 4; i++) {
>    
>       fF[i] = new TGHorizontalFrame(fF1, 200, 30);
>       fF1->AddFrame(fF[i], fL1);
>       fNumericEntries[i] = new TGNumberEntry(fF[i], ninit[i], 3, i + 20,
>                    (TGNumberFormat::EStyle) 0);
>       fF[i]->AddFrame(fNumericEntries[i], fL1);
>       fLabel[i] = new TGLabel(fF[i], nlabel[i]);
>       fF[i]->AddFrame(fLabel[i], fL1);
>    }
>    
>    fHor2 = new TGHorizontalFrame(fF1, 200, 30);
>    fF1->AddFrame(fHor2, fL1);
>    fExit = new TGTextButton(fHor2, "Exit", 2);
>    fHor2->AddFrame(fExit, fL1);
>    
>    fExit->SetCommand(".q" );
>    
>   
>    fMain->MapSubwindows();
>    
>    fMain->Resize();
>    
>    fMain->SetWindowName("LdfToRoot Program");
>  
>    fMain->MapWindow();
> }
> 
> MyMainFrame::~MyMainFrame()
> {
>     delete fExit;
>     delete fCheck;
>    
>     delete fF1;
>     delete fF2;
>     delete [] fF;
>     delete fHor1; 
>     delete fHor2;
>     delete [] fLabel;
>     delete [] fNumericEntries;
>     
>     delete fL1;
>     delete fL2;
>     delete fL3;
>    
> 
>     delete fMenuBarLayout;
>     delete fMenuBarItemLayout;
>     delete fMenuBarHelpLayout;
> 
>     delete fMenuFile;
>     delete fMenuTest;
>     delete fMenuView;
>     delete fMenuHelp;
> 
>    delete fMain;
> }
> 
> void MyMainFrame::CloseWindow()
> {
>    gApplication->Terminate(0);
> }
> void MyMainFrame::HandleMenu(Int_t id)
> {
> 
> }
> 


--------------------------------------------------------------------------------


> #include <TROOT.h>
> #include <TApplication.h>
> #include <TGClient.h>
> #include <TGFrame.h>
> #include <TGButton.h>
> #include <TGButtonGroup.h>
> #include <TGLabel.h>
> #include <TGNumberEntry.h>
> #include <TGFrame.h>
> #include <TGMenu.h>
> #include <RQ_OBJECT.h>
> 
> 
> enum ETestCommandIdentifiers {
>    M_FILE_OPEN,
>    M_FILE_SAVE,
>    M_FILE_SAVEAS,
>    M_FILE_PRINT,
>    M_FILE_PRINTSETUP,
>    M_FILE_EXIT,
> 
>    M_TEST_DLG,
>    M_TEST_MSGBOX,
>    M_TEST_SLIDER,
>    M_TEST_SHUTTER,
>    M_TEST_DIRLIST,
>    M_TEST_FILELIST,
>    M_TEST_PROGRESS,
>    M_TEST_NUMBERENTRY,
> 
>    M_HELP_CONTENTS,
>    M_HELP_SEARCH,
>    M_HELP_ABOUT,
> };
> 
> class MyMainFrame {
> 
> RQ_OBJECT("MyMainFrame");
> 
> private:
>     TGMainFrame        *fMain;
>     TGTextButton       *fExit;
>     TGCheckButton      *fCheck;
>    
>     TGVerticalFrame      *fF1;
>     TGVerticalFrame      *fF2;
>     TGHorizontalFrame    *fF[4],*fHor1,*fHor2;
>     TGLabel              *fLabel[4];
>     TGNumberEntry        *fNumericEntries[4];
>     
>     TGLayoutHints        *fL1;
>     TGLayoutHints        *fL2;
>     TGLayoutHints        *fL3;
>     
>     TGPopupMenu        *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
>     TGPopupMenu        *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
>     TGLayoutHints      *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
>     
> public:
>     MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h);
>     virtual ~MyMainFrame();
>     
>     void CloseWindow();
>     void HandleMenu(Int_t id);
>     
> };
> 


--------------------------------------------------------------------------------


> 
> #include "MyMain.h"
> 
> #ifdef STANDALONE
> TROOT root("Ldf Test", "Ldf Test");
> 
> int main(int argc, char **argv) 
> { 
>     TApplication theApp("App", &argc, argv);
>     MyMainFrame mainWin(gClient->GetRoot(), 400, 220);
>     theApp.Run();
>     
>     return 0;
> }
> #endif
> 



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:10 MET