Bug? DataGrid and Resize column also created Click Event

Jun 25, 2014 at 8:00 PM
Hello,

I have issue where resize column created click event. In my opinion two of these should be separate events. I ma using DataTable and trying to use Sort to apply multi column sorting. So for this I use on Click event.
        SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
        clickEvent.Click += new EventHandler(Header_ClickEvent);
        clickEvent.KeyDown += new KeyEventHandler(ClickEvent_KeyDown);

        KeyEvent keyEvent = new KeyEvent(this);

        _dataGrid.Controller.AddController(clickEvent);
        _dataGrid.Controller.AddController(keyEvent);
So when I click on column I do own sorting. Now what is happening is that when I resize any column Click is also called causing sorting. I do not see any proper indicating that resize was performed to filter it out. Is there a better way to do what I am trying to do? Or is this a bug?
Coordinator
Jun 26, 2014 at 8:57 AM
No, this should not happen - resizing should not generate Click event. Are you sure that you don't generate click event when you do resizing? How do you initiate that?
Jun 26, 2014 at 2:31 PM
I did standard column resize just like excel or explorer.
Nothing unusual. I did try this extra carful and same deal.
I did hover over splitter between columns until I got icon indicating I can resize
Then left mouse click and drag until happy with resize and released.
Nothing unusual

We're you able to reproduce?
Jun 27, 2014 at 8:18 PM
I created simple example to this case. But I do not see way to attach it here. Is there a way to send it yo you if you do not mind?
Jun 27, 2014 at 8:23 PM
Edited Jun 27, 2014 at 8:24 PM
Actually here is stack trace for two events. Looks like both events generate MouseClick

This one is clicking on column
DAnalytics.SessionTab.Header_ClickEvent(object sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 75 Y = 11 Button = Left}) Line 350 C#
SourceGrid.dll!SourceGrid.Cells.Controllers.CustomEvents.OnClick(SourceGrid.CellContext sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 75 Y = 11 Button = Left}) Line 84 + 0x42 bytes C#
SourceGrid.dll!SourceGrid.Cells.Controllers.ControllerContainer.OnClick(SourceGrid.CellContext sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 75 Y = 11 Button = Left}) Line 103 + 0x2d bytes C#
SourceGrid.dll!SourceGrid.GridVirtual.OnMouseClick(System.Windows.Forms.MouseEventArgs e = {X = 75 Y = 11 Button = Left}) Line 1726 + 0x7e bytes    C#
[External Code] 
DAnalytics.exe!DAnalytics.Program.Main() Line 18 + 0x1d bytes   C#
[External Code] 

This one is dragging column (resize) and releasing mouse right after drag / resize
>   DAnalytics.SessionTab.Header_ClickEvent(object sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 196 Y = 20 Button = Left}) Line 350 C#
SourceGrid.dll!SourceGrid.Cells.Controllers.CustomEvents.OnClick(SourceGrid.CellContext sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 196 Y = 20 Button = Left}) Line 84 + 0x42 bytes    C#
SourceGrid.dll!SourceGrid.Cells.Controllers.ControllerContainer.OnClick(SourceGrid.CellContext sender = {SourceGrid.CellContext}, System.EventArgs e = {X = 196 Y = 20 Button = Left}) Line 103 + 0x2d bytes    C#
SourceGrid.dll!SourceGrid.GridVirtual.OnMouseClick(System.Windows.Forms.MouseEventArgs e = {X = 196 Y = 20 Button = Left}) Line 1726 + 0x7e bytes   C#
[External Code] 
DAnalytics.exe!DAnalytics.Program.Main() Line 18 + 0x1d bytes   C#
[External Code] 
Jun 27, 2014 at 8:57 PM
Edited Jun 27, 2014 at 8:58 PM
Also I did try to modify Example 21 to add key event (By the way I corrected Column labels from original source). This also produces click after resize and mouse release
        SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents();
        clickEvent.Click += new EventHandler(clickEvent_Click);

        //1 Header Row
        grid1[0, 0] = new MyHeader("1 Column Header");
        grid1[0, 0].AddController(clickEvent);
        grid1[0, 0].ColumnSpan = 3;
        grid1[0, 3] = new MyHeader("2 Column Header");
        grid1[0, 3].ColumnSpan = 5;
        grid1[0, 8] = new MyHeader("3 Column Header");
        grid1[0, 9] = new MyHeader("4 Column Header");
Do you know how to fix this? I am looking at this but perhaps you have quick solution since you know source better then I am