wxDataViewListCtrl and wxTAB_TRAVERSAL don't play nice?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
User avatar
Disch
Experienced Solver
Experienced Solver
Posts: 99
Joined: Wed Oct 17, 2007 2:01 am

wxDataViewListCtrl and wxTAB_TRAVERSAL don't play nice?

Post by Disch » Fri Oct 08, 2010 11:52 pm

I've been ripping my hair out all day trying to get wxDataViewListCtrl to work. In particular, I had one problem that would persist:

- whenever I would edit a text field, pressing enter would do nothing (when it should end the editing session). I would have to click on another field in the control to end the editing.

After much tinkering around, I discovered the problem was related to me giving the wxTAB_TRAVERSAL style to my frame.

I made a minimal recompilable example to illustrate the problem:

Code: Select all

#include <wx/wx.h>
#include <wx/dataview.h>

class Frame : public wxFrame
{
public:
	Frame(long style)
		: wxFrame(0,wxID_ANY,wxT("Test"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_FRAME_STYLE | style)
	{
		wxBoxSizer* siz = new wxBoxSizer(wxVERTICAL);

		wxDataViewListCtrl* lc = new wxDataViewListCtrl( this, wxID_ANY );
		lc->AppendTextColumn( wxT("Text") , wxDATAVIEW_CELL_EDITABLE, -1, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE );

		wxVector<wxVariant> vec;
		vec.push_back( wxString( wxT("edit me") ) );

		lc->AppendItem(vec);

		
		siz->Add( lc, 1, wxEXPAND, 0 );
		SetSizer( siz );
		Layout();
	}
};

class App : public wxApp
{
public:
	bool OnInit()
	{
		if(!wxApp::OnInit())	return false;

		Frame* frm = new Frame(wxTAB_TRAVERSAL); // change this to 0, and bug is fixed
		SetTopWindow(frm);
		frm->Show();
		return true;
	}
};
IMPLEMENT_APP(App);
The problem is occuring on Windows Vista, with wxWidgets 2.9.1, compiled with MSVC++ 2010 express.



Somewhat more importantly, this exposed another problem that I think might be a bug. If you close the window while you're still editing a text field, wx explodes, throws all sorts of assertion failures, and crashes. This happens regardless of wxTAB_TRAVERSAL.

Should I file these as bug reports? Are they already known? Honestly I'm new to filing bugs so I don't know how it works.

Post Reply