Hi Thomas,
the first thing that is wrong is that the parent of "frame" should be
"main" and not the root window. Next is that ~ is not expanded by
CreatePictureFromFile(). Use first gSystem->ExpandPathName() to get the
full pathname.
Cheers, Fons.
On Fri, 2002-06-07 at 12:00, Thomas Bretz wrote:
> Hi,
>
> what's wrong with the macro below? CreatePictureFromFile already
> fails...
> Reading the same file into the TGPicturePool works, but that's nothing
> which will help (but tells us, that the file is ok)
>
> I'm using root 3.02/07. It did somthing similar with 2.25 (I read the
> file by myself and used CreatePictureFromData instead) and this worked.
> In 3.00 and 3.01 I got some massages about a 'Bad Window' or similar,
> now it simply doesn't do anything and CreatePictureFromData return with
> kTRUE.
>
> Thomas.
> ----
>
> void test()
> {
> TGMainFrame *main=new TGMainFrame(gClient->GetRoot(), 200, 200);
> TGFrame *frame=new TGFrame(gClient->GetRoot(), 150, 150);
>
> main->AddFrame(frame);
> frame->Move(10, 10);
>
> main->MapSubwindows();
> main->MapWindow();
>
> Pixmap_t fPixmap=kNone;
> Pixmap_t mask = kNone;
> PictureAttributes_t attr;
> memset(&attr, 0, sizeof(attr));
>
> if (!gVirtualX->CreatePictureFromFile(frame->GetId(), "~/Mars/marslogo.xpm",
> fPixmap, mask, attr))
> return;
>
> cout << "created." << endl;
>
> GContext_t fDefGC = gVirtualX->CreateGC(frame->GetId(), 0); // GetBckgndGC().GetGC(); //
> gVirtualX->CopyArea(fPixmap, frame->GetId(), fDefGC,
> 0, 0, 100, 100, 10, 10);
> }
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7679480
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:57 MET