how to get an image from an .XRS file

50 views
Skip to first unread message

C. Iacob

unread,
Oct 6, 2005, 1:05:33 PM10/6/05
to wx-u...@lists.wxwindows.org
Hi list,

for our application I created an .xrs file. With a zip extractor I
can see its content. The acp.xrs file contains among .xrc files a
couple of .png files, such as "acp.xrs$makevp_wdr_dummyBitmaps0.png".

I need to access these files but couldn't figure out how to do it
yet. I tried, one by one, all of the following:

wxBitmap bmp =
wxXmlResource::Get()->LoadBitmap("makevp_wdr_dummyBitmaps0.png");

wxBitmap bmp =
wxXmlResource::Get()->LoadBitmap("acp.xrs$makevp_wdr_dummyBitmaps0.png");

wxBitmap bmp =
wxXmlResource::Get()->LoadBitmap("acp.xrs$makevp_wdr_dummyBitmaps0");

wxBitmap bmp =
wxXmlResource::Get()->LoadBitmap("makevp_wdr_dummyBitmaps0");

wxBitmap bmp = wxXmlResource::Get()->LoadBitmap("dummyBitmaps0");

but for all of them, bmp.Ok() returned false.

I can load a dialog from the acp.xrs file, but I don't know how to
load a bitmap. Can anyone help, please?

Thank you,

Cristina.


Armel Asselin

unread,
Oct 7, 2005, 7:50:52 AM10/7/05
to wx-u...@lists.wxwidgets.org

Hi Cristina,

it seems that you're not using the stuff the right way. To access a bitmap
"the XRC way", you have to put lines like that in your XRC:

<object class="wxBitmap" name="small-check-10">small-check-10.png</object>

and then in your code:
check_icon = wxXmlResource::Get()->LoadBitmap(wxT("small-check-10"));

the other way (without the XRC stuff) is to load the bitmap directly using
code such as:

mybitmap.LoadFile(wxT("the_archive.zip$theimagename.png"),
wxBITMAP_TYPE_PNG)

(with the wxZipFsHandler installed as well as the wxPNGHandler)

wish it helps
Armel

Reply all
Reply to author
Forward
0 new messages