#include "TGLayout.h" #include "TGFrame.h" #include "TGButton.h" #include "TGClient.h" #include "TGPicture.h" #include "TGResourcePool.h" #include void tgui() { #include "hpxpy.xpm" Int_t ax = 100, ay=400; TGLayoutHints * lo1 = new TGLayoutHints(kLHintsExpandX|kLHintsCenterX|kLHintsCenterY , 2, 2, 2, 2); TGMainFrame *mainframe = new TGMainFrame(gClient->GetRoot(), 264, 200); Int_t win_width =244; TGCompositeFrame *hframe1 = new TGCompositeFrame(mainframe, win_width, 20, kHorizontalFrame); TGCompositeFrame *hframe2 = new TGCompositeFrame(mainframe, win_width, 20, kHorizontalFrame); // create a picture from xpm output: static char *asxpm[] = {... const TGPicture * pict1 = gClient->GetPicturePool()->GetPicture("h1", (char**)asxpm); // why does the following not work????? const TGPicture * pppp = gClient->GetPicturePool()->GetPicture("h1", (UInt_t)80,(UInt_t)80); std::cout << "Try to get picture after creation: pppp " << pppp << std::endl; // use pointer to picture as returned at creation TGPictureButton * tb1 = new TGPictureButton(hframe1, pict1, 1003); hframe1->AddFrame(tb1,lo1); // get a picture from my iconpath const TGPicture * pict2 = gClient->GetPicturePool()->GetPicture("removegrid.xpm",(UInt_t)80,(UInt_t)80); TGPictureButton * tb2 = new TGPictureButton(hframe2, pict2, 1004); hframe2->AddFrame(tb2,lo1); mainframe->AddFrame(hframe1,lo1); mainframe->AddFrame(hframe2,lo1); mainframe->MapSubwindows(); mainframe->Resize(); mainframe->Move(ax, ay); mainframe->SetWMPosition(ax, ay); mainframe->MapWindow(); // mainframe->Print(); }