Page 1 of 1

Editing dates in wxDataViewListCtrl

Posted: Sat Oct 09, 2010 12:15 am
by Disch
Hey everyone. I've been posting a lot about my adventures with wxDataViewListCtrl and related classes.

I've gotten most of it worked out. The last thing I need to learn how to do is have a date editable from within the wxDataViewListCtrl (or whatever other class I need to use instead).

Here's my simple test-bed program:

Code: Select all

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

class Frame : public wxFrame
{
public:
	Frame()
		: wxFrame(0,wxID_ANY,wxT("Test"))
	{
		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 );
		lc->AppendDateColumn( wxT("A Date"), 1, wxDATAVIEW_CELL_EDITABLE, -1, wxALIGN_NOT, wxDATAVIEW_COL_RESIZABLE | wxDATAVIEW_COL_SORTABLE ); // ISN'T EDITABLE

		wxVector<wxVariant> vec;
		vec.push_back( wxString( wxT("some text") ) );
		vec.push_back( wxDateTime( 3, wxDateTime::Feb, 1983 ) );  // ISN'T EDITABLE

		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();
		SetTopWindow(frm);
		frm->Show();
		return true;
	}
};
IMPLEMENT_APP(App);
How can I make the date editable? Please note I'd like it to be directly editable (don't want to have another window pop up)


I've spent all day pouring over documentation and examples and troubleshooting other problems I've been having so I'm all burnt out. I'm really hoping someone here can provide an easy solution or at least point me in the right direction.


Thanks everyone! As always I would really appreciate your advice!