[wxruby-users] xml.load_panel
Alex Fenton
alex at pressure.to
Fri Aug 29 10:15:31 EDT 2008
Max Salov wrote:
> Alex Fenton wrote:
>
>> Hmm, I get the same error with 1.9.7. I had originally tried with the
>> current SVN version, which works fine, although I'm not quite sure
>> what's changed.
On going through the ChangeLog, I see this was in fact specifically
fixed for version 1.9.8
> I don't know my new problem is the same, but now I have the following
> XRCPanel is generated from xrc-file by xrcise
>
>
> #Works fine
> class NewPanel < XRCPanel
> def initialize parent = nil
> super
> end
> end
>
Have a look at the code of your XRCPanel. It takes a single-argument,
parent, but it calls Wx::Panel.new() with no arguments, which is the way
it's done for loading from XRC. So you need to call new in XRCPanel with
a correct parent argument; it will deal with the rest.
> # puts don't get executed and panel content is not updated at all
> # and is not visible
> class NewPanel < XRCPanel
> def initialize parent = nil
> super()
> puts 'Hello, World!'
> end
> end
>
Here you're telling the Panel it should be attached to +nil+ so it won't
display properly, or might even crash.
> #Works fine but 'on_init' is optional
> class NewPanel < XRCPanel
> def on_init
> puts "Hello, World!"
> end
> end
>
This is deprecated and will be dropped from future versions of XRCise -
its use is discouraged.
alex
More information about the wxruby-users
mailing list