[wxruby-users] xrc panels using xrcise

Alex Fenton alex at pressure.to
Tue Aug 12 12:54:48 EDT 2008


Hi Fabio

Fabio Petrucci wrote:
> I'm facing a problem generating base classes using xrcise.
>
> i've this xrc layout:
> ...
>
> ..as the xrcise tutorial 
> <http://wxruby.rubyforge.org/wiki/wiki.pl?UsingXRCise> say:
>
> " Note that whereas the "Class" field of top-level Frames, Dialogs and 
> Panels will become Ruby *classes*, for the controls within a 
> container, the "Class" field is the name of a Ruby *module* used to 
> extend the control."
>
> but no classes are generated for the two panels inside wxNotebook 
> (contatti and config)
>
> Is there any options to force panel class generation?
>
It doesn't really work this way. The class always corresponds to a 
top-level element in the XRC - in this case, your frame. This limitation 
comes from WxWidgets. This base class is generated by XRCise.

To link ruby code behaviours to contained elements - like your panels - 
you write a ruby a module with the same name as the 'subclass' attribute 
in the XRC. Then, when the whole layout is loaded from XRC, the elements 
will be extend-ed with that module.

hth
alex



More information about the wxruby-users mailing list