chyftom
Joined: 22 Oct 2009 Posts: 5
|
Posted: Fri Dec 04, 2009 11:33 am Post subject: CellMouseDown in tree Version 3.14.0 |
|
|
Dear Infralution,
Why tree.SelectedItem is null in the tree.CellMouseDown event with Version 3.14.0?
I generate the dynamic tree.ContextMenuStrip in the tree.CellMouseDown event with Version 3.5.0, use the tree.SelectedItem != row.Item to prevent they are not same in case,i mean the tree does not select the new location row when CellMouseDown event fire,then tree.SelectedItem is still the last row. but now with the new tree version, it doesn't work. here some example codes:
private void tree_CellMouseDown(object sender, MouseEventArgs e)
{
CPLMainViewSet.isRightClick = false;
Column col = ((CellWidget)sender).Column;
Row row = ((CellWidget)sender).Row;
if (row == null || col == null) return;
if (e.Button == MouseButtons.Right)
{
if (tree.SelectedItem != row.Item) // Now the tree.SelectedItem is always null with new Version 3.14.0
{
tree.ContextMenuStrip = null;
return;
}
if (row.Item is Type1Row)
{
-------------------
tree.ContextMenuStrip = 'XXXXXXXXXXX'
}
else if(row .Item is Type2Row)
{
tree.ContextMenuStrip = 'XXXXXXXXXXXX'
}
}
Thanks a lot
developer YFTOM |
|