[wxruby-users] load_panel_subclass help
Alex Fenton
alex at pressure.to
Wed Sep 17 06:55:10 EDT 2008
Fabio
> the problem is related on code organization:
>
> The xrc file consist of 1 frame and, inside it, a notebook with 2
> folders
> (panels).
> Conceptually they are separated objects with their own code and logic.
>
> What i need is to separate these entities into their own class for
> better
> code organization avoiding to encapsulate them into a external custom
> proxy
> class: that's the reason i used 'load_panel_subclass'
Use Ruby Modules instead of Classes to encapsulate the behaviour of
the inner windows, such as your Panel. After the layout has been loaded
from XRC, retrieve the panel, and use something like
panel.extend(MyPanelBehaviours)
To add the logic to it. If needed, you can use Module.extended to do initialize-
like work in setting up the Panel.
By the way, XRCise will do this automatically for you, if you name your
inner windows.
hth
alex
More information about the wxruby-users
mailing list