[wx-dev] wxDataViewCtrl Tree API

Robin Dunn robin at alldunn.com
Mon Jun 4 08:35:23 PDT 2007


Vadim Zeitlin wrote:
> On Mon, 04 Jun 2007 17:20:40 +0800 Bo Yang <techrazy.yang at gmail.com> wrote:

> BY> Below is what the three part do when there is need to display the model,
> BY> new node added/deleted, value change, collapsing/expanding.
> BY> 
> BY> 1.Display the Model.
> BY>    wxDataViewCtrl->AssociateModel( wxDataViewTreeModel);

This should probably be SetModel to be consistent with all the other 
setters in wx.  I assume there will be a GetModel too.


> BY>    When the user call this method, the wxDataViewCtrl will create a
> BY> ModelAdapter with the tree model as a argument.
> 
>  The question here is how does it now which adaptor to create? I guess the
> model should have a (virtual) method creating the appropriate adaptor for
> it. This doesn't seem very nice but I don't see how to do it otherwise.


Why not just create a default ModelAdapter when things are first 
created, and then allow the user to call a SetModelAdapter method with 
an instance of a custom adapter class if they want to change it.  Or 
maybe it could be an optional parameter of the SetModel method.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wx-dev mailing list