Opened 6 months ago

Closed 5 months ago

Last modified 5 months ago

#16257 closed defect (fixed)

wxDataViewCtrl AppendColumn and AssociateModel call order

Reported by: johnr Owned by: VZ
Priority: normal Milestone:
Component: wxOSX-Cocoa Version: dev-latest
Keywords: wxDataViewCtrl AppendColumn model order Cc:
Blocked By: Blocking:
Patch: no

Description

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.

Change History (2)

comment:1 Changed 5 months ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from new to closed

In 76645:

Don't check for model in wxDataViewCtrl::InsertColumn() in wxOSX.

This isn't done in neither generic nor the GTK versions and prevents from
inserting the columns into the control before associating a model with it.

Closes #16257.

comment:2 Changed 5 months ago by VZ

In 76647:

Don't check for model in wxDataViewCtrl::InsertColumn() in wxOSX.

This isn't done in neither generic nor the GTK versions and prevents from
inserting the columns into the control before associating a model with it.

Closes #16257.

Note: See TracTickets for help on using tickets.