Hello, I need to finish a small GUI program till friday and I am somewhat stuck. First of all, wxRuby seems to ignore the size request of the frame as defined via XRC (or I''m completly doing the wrong thing!) Second, it complains about the statusbar and doesn''t display it. What am I doing wrong? The files are attached Thank you Ulrich Spoerlein -- PGP Key ID: F0DB9F44 Encrypted mail welcome! Fingerprint: F1CE D062 0CA9 ADE3 349B 2FE8 980A C6B5 F0DB 9F44 Ok, which part of "Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn." didn''t you understand? -------------- next part -------------- <?xml version="1.0" encoding="ISO8859-15"?> <!-- generated by wxGlade 0.3.5.1 on Sat Nov 13 21:10:06 2004 --> <resource version="2.3.0.1"> <object class="wxFrame" name="frame_1"> <style>wxDEFAULT_FRAME_STYLE</style> <title>Stupid Test</title> <centered>1</centered> <size>667, 563</size> <object class="wxBoxSizer"> <orient>wxVERTICAL</orient> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxNotebook" name="notebook_1"> <usenotebooksizer>1</usenotebooksizer> <object class="notebookpage"> <label>tab1</label> <object class="wxPanel" name="notebook_1_pane_1"> <style>wxTAB_TRAVERSAL</style> <object class="wxStaticBoxSizer"> <orient>wxHORIZONTAL</orient> <label>Foo</label> <object class="sizeritem"> <option>1</option> <flag>wxEXPAND</flag> <object class="wxListCtrl" name="list_ctrl_1"> <style>wxLC_REPORT|wxSUNKEN_BORDER</style> </object> </object> </object> </object> </object> <object class="notebookpage"> <label>tab2</label> <object class="wxPanel" name="notebook_1_pane_2"> <style>wxTAB_TRAVERSAL</style> <object class="wxStaticBoxSizer"> <orient>wxVERTICAL</orient> <label>Blah</label> <object class="sizeritem"> <option>3</option> <flag>wxEXPAND</flag> <object class="wxListCtrl" name="list_ctrl_2"> <style>wxLC_REPORT|wxSUNKEN_BORDER</style> </object> </object> <object class="sizeritem"> <option>2</option> <flag>wxEXPAND</flag> <object class="wxListCtrl" name="list_ctrl_3"> <style>wxLC_REPORT|wxSUNKEN_BORDER</style> </object> </object> </object> </object> </object> </object> </object> </object> <object class="wxMenuBar" name="frame_1_menubar"> <object class="wxMenu" name="The File Menu"> <label>File</label> <object class="wxMenuItem" name="Open a file"> <label>Open</label> </object> </object> </object> <object class="wxStatusBar" name="frame_1_statusbar"> <fields>2</fields> <widths>-1, -3</widths> </object> </object> </resource> -------------- next part -------------- #!/usr/local/bin/ruby require "wxruby" class Foo < Wx::App def on_init Wx::init_all_image_handlers() $xml = Wx::XmlResource.get(); $xml.init_all_handlers(); $xml.load("foo.xrc") $main = $xml.load_frame(self, "frame_1") $main.show(true) end end Foo.new.main_loop
Not sure about the size issue (I''m not sitting at a computer with wxRuby at the moment to try it out) but I believe the status bar problem is due to wxRuby currently using wxWidgets 2.4.2. XRC support for wxStatusBar wasn''t added until 2.5.1, according to the wxWidgets change log. I worked around this by just putting a label at the bottom of the frame and placing a horizontal line over it with no left/right borders; another solution would be to add the status bar in code after the frame is loaded from the XRC file. Marshall On Nov 13, 2004, at 12:12 PM, Ulrich Spoerlein wrote:> Hello, > > I need to finish a small GUI program till friday and I am somewhat > stuck. First of all, wxRuby seems to ignore the size request of the > frame as defined via XRC (or I''m completly doing the wrong thing!) > > Second, it complains about the statusbar and doesn''t display it. What > am > I doing wrong? > > The files are attached > > Thank you > Ulrich Spoerlein > -- > PGP Key ID: F0DB9F44 Encrypted mail welcome! > Fingerprint: F1CE D062 0CA9 ADE3 349B 2FE8 980A C6B5 F0DB 9F44 > Ok, which part of "Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn." > didn''t you understand? > > <foo.xrc><gui.rb>_______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users
OK, regarding the size of the frame: it looks like specifying a sizer for a frame in XRC causes the frame to fit the sizer automatically. If you want a minimum size for the frame, you can set the minsize attribute on the frame''s sizer. If you''re just looking to set a default size for a user-resizable frame, you might want to provide a default in code after the frame loads from the XRC file. Ideally you''d load a user preference for the frame size, with the default size used if no preference is found, but it sounds like this isn''t a big enough project to be worth the effort. :-) Hope this helps, Marshall On Nov 13, 2004, at 12:12 PM, Ulrich Spoerlein wrote:> Hello, > > I need to finish a small GUI program till friday and I am somewhat > stuck. First of all, wxRuby seems to ignore the size request of the > frame as defined via XRC (or I''m completly doing the wrong thing!) > > Second, it complains about the statusbar and doesn''t display it. What > am > I doing wrong? > > The files are attached > > Thank you > Ulrich Spoerlein > -- > PGP Key ID: F0DB9F44 Encrypted mail welcome! > Fingerprint: F1CE D062 0CA9 ADE3 349B 2FE8 980A C6B5 F0DB 9F44 > Ok, which part of "Ph''nglui mglw''nafh Cthulhu R''lyeh wgah''nagl fhtagn." > didn''t you understand? > > <foo.xrc><gui.rb>_______________________________________________ > wxruby-users mailing list > wxruby-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users