From: Kapell, J. <jk...@ti...> - 2003-09-22 13:01:28
|
Hello, do you have initialised the XRC handler before via 'InitAllHandlers'? I've tried something with XRC and it works good, but not yet with wxGrid. Also I could not work with sub classing at XRC. It seems that this isn't implemented yet. Below you can find a short example taken from the wxPerl examples. Mattia: Do you have a plan when sub classing are available via XRC? Or do anybody know, how to handle a 'virtual' list control via XRC? Best regards Jens ===> file 'xrc_test.pl' #!/usr/bin/perl use strict; use warnings; package wxToplevelFrame; use Wx qw(:everything); use Wx::XRC; use base qw(Wx::Frame); # Inherit from Wx::Frame sub new { my $class = shift; my $self = $class->SUPER::new(@_); # Load frame. $self->{xrc_frame} = Wx::XmlResource->new; $self->{xrc_frame}->InitAllHandlers(); $self->{xrc_frame}->Load('frame.xrc'); $self->{xrc_frame}->LoadFrame($self, undef, 'main_frame') || die "Can't load frame 'main_frame': $!"; return $self; } # END: new package wxXRCFrameApp; use Wx qw(:everything); use base qw(Wx::App); # Inherit from Wx::App sub OnInit { my $self = shift; my $toplevel_frame = wxToplevelFrame-> new ( undef, # Parent window -1, # Window id 'XRC Frame', # Title wxDefaultPosition, # position X, Y [800,600], ); $self->SetTopWindow($toplevel_frame); # Define the toplevel window $toplevel_frame->Show(1); # Show the frame } # END: OnInit package main; my $xrc_frame_app = wxXRCFrameApp->new(); $xrc_frame_app->MainLoop; ===> file 'frame.xrc' <?xml version="1.0" encoding="ISO-8859-1"?> <resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1"> <object class="wxFrame" name="main_frame"> <title>Warlick</title> <centered>1</centered> <object class="wxFlexGridSizer"> <cols>1</cols> <rows>0</rows> <vgap>0</vgap> <hgap>0</hgap> <growablecols>0</growablecols> <growablerows>0</growablerows> <object class="sizeritem"> <flag>wxGROW|wxALIGN_CENTER_VERTICAL|wxALL</flag> <border>5</border> <object class="wxTextCtrl" name="message_textctrl"> <size>500,280</size> <style>wxTE_MULTILINE</style> <value>Welcome to the wxWindows XmlResource (XRC) sample! Using wxWindows XML resources makes your GUI C++ programming much faster and easier.\n\nView the examples under the "Basic" menu to learn how to get up and running with XRC quickly, and later have a look at the examples under the "Advanced" menu for advanced techniques.\n\nThe XML file that described this frame is the sample's frame.xrc file, with the menu in menu.xrc, and the toolbar in toolbar.xrc. The frame XRC file structure is exactly the same as the XRC files for the dialogs, except that the top level node is a wxFrame, not a wxDialog. Each of the other dialog in this example is a separate XRC file, each of which can be examined for how they work.</value> </object> </object> </object> </object> </resource> -----Original Message----- From: Mark Wardell [mailto:ma...@ne...] Sent: Monday, September 22, 2003 2:30 PM To: wxp...@li... Subject: [wxperl-users] Help with Wx::Grid and XRC I am trying to load a dialog from XRC containing a wxGrid and I am getting errors: - No handler found for XML node 'object', class 'wxGrid' - Error in resource. Has anybody tried this? It sounds like the 'Wx::XmlResource' object cannot handle a wxGrid resource. Do I have to create a handler for wxGrid? If yes, can anybody help with info on this? ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ wxperl-users mailing list wxp...@li... https://lists.sourceforge.net/lists/listinfo/wxperl-users |