Dear Rooters, Good morning !
I am tring to add the menu bar on my frame containing a title (File, Test,Help)
I followed all the instructions in the users guide, but there is only one title (File) which is posted. Can somebody help me to look where is the error in my program?
I maked thesame with the toolbar and I got thesame problem.
this is the macro and in attachement the resut I obtained
[code]// Mainframe macro generated from application: C:\root\bin\root.exe
// By ROOT version 5.17/02 on 2008-01-25 04:09:24
#include “Riostream.h”
void menubar()
{
// main frame
TGMainFrame *fMainFrame = new TGMainFrame(0,10,10,kMainFrame | kVerticalFrame);
fMainFrame->SetLayoutBroken(kTRUE);
// embedded canvas
TRootEmbeddedCanvas *fRootEmbeddedCanvas = new TRootEmbeddedCanvas(0,fMainFrame,280,136);
Int_t wfRootEmbeddedCanvas = fRootEmbeddedCanvas->GetCanvasWindowId();
TCanvas *c = new TCanvas(“c”, 10, 10, wfRootEmbeddedCanvas);
fRootEmbeddedCanvas->AdoptCanvas©;
fMainFrame->AddFrame(fRootEmbeddedCanvas, new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2));
fRootEmbeddedCanvas->MoveResize(32,32,280,136);
// a popup menu
fMenuFile = new TGPopupMenu(gClient->GetRoot());
fMenuTest = new TGPopupMenu(gClient->GetRoot());
fMenuHelp = new TGPopupMenu(gClient->GetRoot());
// adding menu entries
fMenuFile->AddEntry("&Open…",1);
fMenuFile->AddEntry("&Save",1);
fMenuFile->AddEntry(“S&ave as…”,1);
fMenuFile->AddEntry("&Close", -1);
// adding separator
fMenuFile->AddSeparator();
// next group of menu entries
fMenuFile->AddEntry("&Print",1);
fMenuFile->AddEntry(“P&rint setup…”,1);
fMenuFile->AddSeparator();
fMenuFile->AddEntry(“E&xit”,1);
// menu bar item layout hints
fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
// menu bar
fMenuBar = new TGMenuBar(fMainFrame,100,20,kHorizontalFrame);
// adding popup menus
fMenuBar->AddPopup("&File",fMenuFile,fMenuBarItemLayout);
fMenuBar->AddPopup("&Test",fMenuTest,fMenuBarItemLayout);
fMenuBar->AddPopup("&Help",fMenuHelp,fMenuBarHelpLayout);
fMainFrame->SetMWMHints(kMWMDecorAll,
kMWMFuncAll,
kMWMInputModeless);
fMainFrame->MapSubwindows();
fMainFrame->Resize(fMainFrame->GetDefaultSize());
fMainFrame->MapWindow();
fMainFrame->Resize(336,188);
} [/code]
Doc1.doc (28 KB)