XRC-related question

Rob Gayvert rtg at rochester.rr.com
Wed Jul 27 17:21:23 UTC 2005


Cees De Groot wrote:

>I have painted a XRC with a custom object on it - my particular flavor
>of a pluggable list.
>
>WxXmlResourceHandler subclass: #DGVPluggableListXmlResourceHandler ....
>canHandle: xmlNode
>	^self isOfClass: xmlNode classname: DGVPluggableList
>  
>
The last argument should be a string ('DGVPluggableList'), but the 
wrapper converts it anyway, so it's not really a problem.

>doCreateResource
>	
>	| list |
>	list := DGVPluggableList ....
>
>and #initializeStyles, and class #new just the same as the sample. The
>top-level object I need to get from the XRC is a frame, so:
>
>res := WxXmlResource new.
>res initAllHandlers.
>res addHandler: DGVPluggableListXmlResourceHandler new.
>res loadFromString: self class resourceText.
>view _ WxFrame new.
>res loadFrame: view parent: nil name: 'frame'.
>  
>
This looks reasonable. The only difference I see between this and my 
demo is that the demo uses

    res loadObject: self name: 'MyPanel' className: 'WxXmlCustomPanel'.

instead of #loadFrame:parent:name:.  But this would be a real pain if 
you had to load custom instances that way.

>but this results in a Wx error dialog 'Subclass 'DGVPluggableList' not
>found for 'listCtrl', not subclassing!'. So it seems that a step is
>missing to register my pluggable list class with Wx or something like
>that?
>
What does your XRC look like? Does it have a "subclass" attribute? If 
so, try removing it -- I think a subclass
attribute requires a subclass factory.




More information about the Wxsqueak mailing list