Discussion:
problems with wxDataViewCtrl of svn60757 used on wxMSW
(too old to reply)
Luca Cappa
2009-06-05 10:34:36 UTC
Permalink
Hello,

is the wxDataViewCtrl usable on the wxMSW port? I am trying to use it, and
up to know i encountered some weird
problems like:

1) if there DataView is empty, then code like this:

wxDataViewItem lSelItem = mDataViewCtrl->GetSelection ();

returns a lSelItem with an m_id equals to 0, and lSelItem.IsOk ()
returns false. But if the first element is
selected (and the DataView has just one like), then lSelItem is 0 too,
and lSelItem.IsOk () still return false.
I have been able to remove the isOk() check and do the check myself when
needed (e.g. when deleting a row i check
if there is one selected, and i delete that one)

2) All the columns shoud be editable by the user using mouse+keyborad, but
this is not true for all columns:
in fact the user can edit any column added with the
wxDataViewCtrl::AppendTextColumn function, but if i
create a rendered myself and add a column by using
wxDataViewCtrl::AppendColumn, then the column is not
editable although i passed teh wxDATAVIEW_CELL_EDITABLE to the
rendered. The code below show how do I add two
columns to my DataViewCtrl:

wxDataViewColumn* lCol0 = mDVC->AppendTextColumn ("Name", 0,
wxDATAVIEW_CELL_EDITABLE,
120, wxALIGN_CENTER);

wxDataViewTextRenderer* tr = new wxDataViewTextRenderer( "double",
wxDATAVIEW_CELL_EDITABLE);
wxDataViewColumn *lCol1 = new wxDataViewColumn( "Freq Min", tr, 1, 70,
wxALIGN_CENTER,
wxDATAVIEW_COL_SORTABLE | wxDATAVIEW_COL_REORDERABLE |
wxDATAVIEW_COL_RESIZABLE);
mDVC->AppendColumn (lCol1);

The only difference is that one column has the "string" variant type,
while the second has a "double"
variant type.

3) It seems the event wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING is never
sent (or catched, have not checked),
but the wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED and
wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE are.
Anyone could reproduce this by running the "dataview" sample and trying
to editing "Ludwig van Beethoven",
in which case the function void MyFrame::OnStartEditing(
wxDataViewEvent &event) would never be called
(and then you could change the name to Ludwig while that handler should
veto it).

Any suggestion on those 3 problems? Should I use some other controls
present in wxW?

Actually i am using msvc8 as the compiler on Windows XP sp2, and using SVN
revision 60757.

Thanks in advance,
Luca
Vadim Zeitlin
2009-06-06 11:50:42 UTC
Permalink
On Fri, 05 Jun 2009 12:34:36 +0200 Luca Cappa <***@sequoia.it> wrote:

LC> is the wxDataViewCtrl usable on the wxMSW port?

Well, I use it and AFAIK many others do too. It doesn't mean it's totally
bug free or couldn't be improved but it does work for what I use it for.

LC> 1) if there DataView is empty, then code like this:
LC>
LC> wxDataViewItem lSelItem = mDataViewCtrl->GetSelection ();
LC>
LC> returns a lSelItem with an m_id equals to 0, and lSelItem.IsOk ()
LC> returns false. But if the first element is
LC> selected (and the DataView has just one like), then lSelItem is 0 too,
LC> and lSelItem.IsOk () still return false.

Can you reproduce this in the sample? Could you please provide a patch to
do it?

LC> 2) All the columns shoud be editable by the user using mouse+keyborad, but
LC> this is not true for all columns:

I don't know anything about this, sorry.

LC> 3) It seems the event wxEVT_COMMAND_DATAVIEW_ITEM_START_EDITING is never
LC> sent (or catched, have not checked),
LC> but the wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_STARTED and
LC> wxEVT_COMMAND_DATAVIEW_ITEM_EDITING_DONE are.

This must have been recently fixed as it does work as expected in the
sample for me now (r60902).

An aside: at the risk of making Robert unhappy again I just don't
understand who chose these names, they're totally inconsistent with the
other similar controls :-(

Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Juergen Schuhmacher
2009-06-06 17:59:05 UTC
Permalink
This post might be inappropriate. Click to display it.
Vadim Zeitlin
2009-06-06 19:17:42 UTC
Permalink
This post might be inappropriate. Click to display it.
Loading...