From: Steve K. <ha...@ya...> - 2006-05-21 19:08:25
|
did you hand-write the XRC ? To me it looks like a wx problem; you could try to modify the 'xrc' sample to see if you can reproduce with wxWidgets directly. the xrc is created using a rad tool (hatch), and looks no problem to me. I have read the code of wxLua binding as well no found no problem (actually just puch and pop things. so I too highly suspect this is wxWidgets problem but since no one reported it so far in wxBugreport. I need to reporduced it using c++ to confirm Update: yes it seems wxWidgets problem reproduced by c++ code. Actually in c++ I just need to load the frame and show it, it automatically show the panel child; so no one wants to load the panel anymore. but in wxLua it seems not. <code> #include "wx/wx.h" #ifdef __BORLANDC__ #pragma hdrstop #endif #include "wx/xrc/xmlres.h" #include "wx/image.h" #include "wx/frame.h" #define ID_FRAME 10000 #ifndef wxCLOSE_BOX #define wxCLOSE_BOX 0x1000 #endif class t: public wxFrame { DECLARE_CLASS( t ) public: t( ); t( wxWindow* parent, wxWindowID=wxID_ANY, const wxString& caption = _(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX ); bool Create( wxWindow* parent, wxWindowID=wxID_ANY, const wxString& caption = _(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX); void CreateControls(); }; IMPLEMENT_CLASS( t, wxFrame ) t::t( ){} t::t( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ){ SetParent(parent); wxXmlResource::Get()->LoadFrame(this, GetParent(), wxT("ID_FRAME")); wxXmlResource::Get()->LoadPanel(this, wxT("ID_PANEL")); } class TestXRCApp: public wxApp { DECLARE_CLASS( TestXRCApp ) public: TestXRCApp(); virtual bool OnInit(); virtual int OnExit(); }; DECLARE_APP(TestXRCApp) IMPLEMENT_APP( TestXRCApp ) IMPLEMENT_CLASS( TestXRCApp, wxApp ) TestXRCApp::TestXRCApp(){} bool TestXRCApp::OnInit() { wxXmlResource::Get()->InitAllHandlers(); wxXmlResource::Get()->Load(_T("testXRC.xrc")); #if wxUSE_XPM wxImage::AddHandler(new wxXPMHandler); #endif #if wxUSE_LIBPNG wxImage::AddHandler(new wxPNGHandler); #endif #if wxUSE_LIBJPEG wxImage::AddHandler(new wxJPEGHandler); #endif #if wxUSE_GIF wxImage::AddHandler(new wxGIFHandler); #endif t* mainWindow = new t( NULL, ID_FRAME ); mainWindow->Show(true); return true; } int TestXRCApp::OnExit(){ return wxApp::OnExit();} </code> XRC file is <?xml version="1.0" encoding="UTF-8"?> <resource version="2.3.0.1" xmlns="http://www.wxwidgets.org/wxxrc"> <object class="wxFrame" name="ID_FRAME" subclass="t"> <style>wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX</style> <size>400,300</size> <title>t</title> <object class="wxPanel" name="ID_PANEL"> <style>wxSUNKEN_BORDER|wxTAB_TRAVERSAL</style> <object class="wxButton" name="ID_BUTTON"> <label>Button</label> </object> </object> </object> </resource> Assuming this is a wx bug, I suggest you to use a sizer inside the frame wrapping the panel; maybe this will workaround the bug. Nope it doesn work. One thing is, in C++ I do not need to load the panel at all, show the frame is fine (it show the panel as well as all control on the panel; But in wxLua I can not, let me re-check this. Sorry about long email :-) I have file a bug report in wxWidgets page. Cheers, S.KIEU --------------------------------- Do you Yahoo!? Yahoo! Personals: It's free to check out our great singles! |