Opened 13 years ago

Closed 10 years ago

#10154 closed defect (worksforme)

bug with wxDataViewCtrl and custom event handler

Reported by: lillo Owned by:
Priority: normal Milestone:
Component: GUI-generic Version: stable-latest
Keywords: wxDataViewCtrl scrollbars Cc:
Blocked By: Blocking:
Patch: no



As explained in ticket #10053, I've had problems with wxDataViewCtrl under MSW; in my apps the dataview scrollbars are not responsive - I can click them but there is no effect, no scrolling at all.
At first I thought it was related to the assert of ticket #10053, but today after months of pause I've investigated the issue again, and I found out the problem lies in the fact that I'm using a custom event handler added to the event handlers chain of my wxDataViewCtrl via PushEventHandler(). Whenever I remove the PushEventHandler() call, the control scrollbars work as usual again.
Before you ask: it doesn't matter what events are handled nor if Skip() is called on the events; the event handler can also be completely empty.

As a test case, I'm supplying a small patch to the official dataview sample shipped with WX (samples/dataview) that calls PushEventHandler() on the wxDataViewCtrl used as the top-right list in the sample. The list scrollbars will not work with this patch applied.

Tested under MSW, current SVN trunk. Under OSX I have no problems at all, but again OSX uses a native wxDataViewCtrl implementation and not the generic one as MSW does.

Attachments (1)

dataview_sample.patch download (718 bytes) - added by lillo 13 years ago.
Patch for samples/dataview/dataview.cpp to show the problem

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by lillo

Patch for samples/dataview/dataview.cpp to show the problem

comment:1 Changed 13 years ago by roebling

I don't really know what the problem is, but I can assume that pushing the event handling doesn't mix well with the fact that wxDataViewCtrl inherits from wxScrollHelperNative (as well as from wxDataViewCtrlBase) which probably does some event delegation magic.

comment:2 Changed 12 years ago by vadz

  • Milestone 2.9.0 deleted

Resetting 2.9.0 milestone as it's too late for it

comment:3 Changed 10 years ago by vadz

  • Resolution set to worksforme
  • Status changed from new to closed

This works just fine for me with 2.9.2 under MSW:

  • samples/dataview/dataview.cpp

    a b void MyFrame::BuildDataViewCtrl(wxPanel* parent, unsigned int nPanel, unsigned l 
    614614            wxASSERT(!m_ctrl[1] && !m_list_model);
    615615            m_ctrl[1] = new wxDataViewCtrl( parent, ID_ATTR_CTRL, wxDefaultPosition,
    616616                                            wxDefaultSize, style );
     617            m_ctrl[1]->PushEventHandler(new wxEvtHandler);
    618619            m_list_model = new MyListModel;
    619620            m_ctrl[1]->AssociateModel( m_list_model.get() );

Moreover, I have really no idea how could just pushing an event handler break something, it's only possible for something bad to happen if it starts processing events...

Note: See TracTickets for help on using tickets.