- 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);
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.