wxDataViewCtrl problems

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

wxDataViewCtrl problems

Post by Disch »

Hello all. I'm having an extremely difficult time understanding wxDataViewCtrl and related classes. Right now I'm trying to make the most simple of simple test.

Here's what I'm doing so far:

Code: Select all

    wxDataViewListCtrl* m_ctrl = new wxDataViewListCtrl( this, wxID_ANY );

    m_ctrl->AppendToggleColumn( wxT("Toggle") );
    m_ctrl->AppendTextColumn( wxT("Text") );

    wxVector<wxVariant> data;
    data.push_back(false);
    data.push_back(wxT("test"));

    m_ctrl->AppendItem(data);
    m_ctrl->AppendItem(data);
    m_ctrl->Enable();

    mysizer->Add( m_ctrl, 1, wxALL|wxEXPAND, 5 );
Pretty simple, right?

When I run the program everything displays okay, but nothing is editable. I can't check/uncheck the toggle columns, I can't click on the column headers (as if to sort by column). I can't even resize the colummns.

It's as if the control is disabled, but I'm explicitly enabling it!

I'm completely baffled. Am I missing a step?

I'm using MSVC++ 2010 Express on Windows Vista, but the compiler can't be the problem because the samples all compile and run fine.

EDIT: wxWidgets version 2.9.1

Any help appreciated!


ANOTHER EDIT:

As long as I'm posting, I could use some guidance here, as well.

My ultimate goal is to have the following:

- a list-like table
- sortable by individual columns
- text and date columns
- all fields editable "in place" (without a new window popping up)

wxDataViewListCtrl seems to be close, but doesn't seem to allow dates. So would I have to use a wxDataViewCtrl? Do I need to derive my own class from wxDataViewModel? Is there any tutorial on how to do that (the docs and samples are all extremely vague on the whole process)?


Thanks again! Any and all input is appreciated.



YET ANOTHER EDIT: ugh. I had the wrong parent. It seems to be fixed now.

DOH!
Post Reply