Luca Cappa
2009-06-05 10:34:36 UTC
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
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