On Apr 7, 2007, at 12:26 AM, <[EMAIL PROTECTED]>  
<[EMAIL PROTECTED]> wrote:

> I have successfully subclassed the dPanel class previously.  Now I  
> want to
> add some parameters to my subclass, but when I run it I get an  
> error msg
> telling me that _cacheForm is not a property.   How do I call the  
> class with
> my parameters.

        Can you post the traceback? There should be an attribute named  
'_cachedForm' that is common to all UI objects.

> Example:
>
> class RALookupPanel(dabo.ui.dPanel):
>     def _getCodeObjRegID(self):
>         return getattr(self, "_CodeObjRegID", None)
>     def _setCodeObjRegID(self, val):
>         self._CodeObjRegID = val
>     CodeObjRegID = property(_getCodeObjRegID, _setCodeObjRegID)
>
>
> I am trying to call it like this...
>
> lp=RALookupPanel(self, CodeObjRegID = 'somevalue')

        Again, the traceback is essential to find out what isn't working.

> Looking at the dPanel class I see that it has the parameters (self,  
> parent,
> ...., etc)  but don’t know how to deal with the these.

        OK, here's a quick explanation:

class dPanel(_PanelMixin, wx.Panel):
        def __init__(self, parent, properties=None, attProperties=None,  
*args, **kwargs):

        self -> automatically sent by Python to all instances. You never  
send it yourself.
        parent -> Required. Only forms and dialogs can exist without being  
'contained' by another control. The parent parameter is a reference  
to the object that will contain the panel you are creating.
        properties=None -> You can pass properties as a dictionary, with the  
prop name as the key, and the initial value as the value. Defaults to  
None; you can therefore safely ignore it if you don't need it.
        attProperties=None -> Just like the properties parameter, except  
that the values are all strings. This is used when retrieving  
properties and their values from an XML file, such as a .cdxml class  
definition. Unless you're writing something that directly interprets  
such files, you can ignore this.
        *args, **kwargs -> Catch-all for any additional arguments and  
keyword arguments, respectively. I don't want to go into a whole  
explanation, as there are many available on the web (try: http:// 
www.network-theory.co.uk/docs/pytut/KeywordArguments.html, or http:// 
tinyurl.com/yprwyu), but this is the magic that allows for the sort  
of flexibility Paul built into Dabo to pass arbitrary properties to  
objects when they are being created.


-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]

Reply via email to