wxDataViewCtrl AppendColumn and AssociateModel call order
|Reported by:||johnr||Owned by:||VZ|
|Keywords:||wxDataViewCtrl AppendColumn model order||Cc:|
Currently when using the generic DVC in wxMSW we can either use AssociateModel before we AppendColumns or after appending columns.
In dataview_osx.cpp/wxDataViewCtrl::InsertColumn which is used by Prepend/AppendColumn there is the following code that prevents appending columns and then associating a model.
wxCHECK_MSG(GetModel() != NULL, false,"No model associated with control."); wxCHECK_MSG(columnPtr->GetModelColumn() < GetModel()->GetColumnCount(),false,"Column's model column has no equivalent in the associated model.");
These prevent building a DVC, appending columns and then associating a model in that order in wxOSX-Cocoa as we can do in the generic DVC.
With the generic datavgen.cpp/wxDataViewCtrl::AssociateModel it will call m_clientArea->BuildTree(model) and m_clientArea->UpdateDisplay() even if no columns have been appended. This is the way the sample has been built.
We don't have these checks in the generic version and I don't see any problems with the sample and my own code when appending columns and then associating a model in OSX with the checks commented. We can change the model at present when there are columns so why not when building the control. This seems to be a logical order of doing things to me.
There should be some uniformity between DVC variants. We could either remove the checks in OSX or add them to generic DVC. I am all for removing them.