loading XRC file to project Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
anna
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Nov 20, 2008 11:00 am

loading XRC file to project

Post by anna »

hi...

i used wxFormBuilder to generate a dialog ...
so the corresponding c++ and XRC files got
generated....
how do i now incorporate in my proj?

ive added...

#include "wx/xrc/xmlres.h"

and
wxXmlResource::Get()->InitAllHandlers();
wxXmlResource::Get()->Load("WidgetGUI.xrc");
wxDialog Dlg;
wxXmlResource::Get()->LoadDialog(&Dlg,(wxWindow*) mainFrame, "NewDialog" );
Dlg.ShowModal();

.... is that all???

should i add anythin more????
now where shud i put the xrc file????
where does the proj check for WidgetGUI.xrc???
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Post by DavidHart »

Hi Anna,
.... is that all???
Possibly. Why not try it and see if it works???
now where shud i put the xrc file????
That varies depending on platform: see http://docs.wxwidgets.org/stable/wx_wxs ... paths.html. The important thing is to load it from the same place as you put it! So, at the moment, you're trying to load it from the same folder as your exe is in; if it's actually somewhere else, things won't work (Hint: wxXmlResource::Get()->Load returns a bool that you can test).

Regards,

David
anna
Earned a small fee
Earned a small fee
Posts: 23
Joined: Thu Nov 20, 2008 11:00 am

Post by anna »

thank u....
i had to give the full pathname..
wen i did it worked
Post Reply