Home - Forums-.NET - FlyGrid.Net (Windows Forms) - how to detect row change

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

how to detect row change
Link Posted: 08-Sep-2005 22:45
Hi,
At the moment I keep track of the current row and the previous row selected and in grid_NodeSelectedChange I compare those two value, if they are different I know I moved to another row. Is there a better way of doing that (a dedicated event?). Because NodeSelectedChange is called each time I move to another cell, even if it belongs to the same row...

Thank you
Link Posted: 08-Sep-2005 23:00
The best way is using
FlyGrid.NodeFocusChanging, in handler of this event you can determine node.Focused or compare with FlyGrid.Selected.
If node.Focused == false (or not equal to FlyGrid.Selected) - this node coming to be focused, otherwise - coming to be unfocused.
Link Posted: 08-Sep-2005 23:10
If I do :

Private Function dgFilters_NodeFocusChanging(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase) As Boolean Handles dgFilters.NodeFocusChanging

stop

end function


this event is called all the time infinitely. I can send you sample if you wish so. What am I doing wrong?
Link Posted: 08-Sep-2005 23:37
Yes, this event calls when some node going to lose focus and some node going to receive focus, you should determine it Focused property to understand context of event:

Private Function dgFilters_NodeFocusChanging(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase) As Boolean Handles dgFilters.NodeFocusChanging

  If (node.Focused = False) Then 'context: node before receiving focus
    '... node coming to receive focus
  End If

  ' return False to cancel receiving focus

End Function
Link Posted: 09-Sep-2005 00:33
Ok I understand that. However that doesn't explain why this event is triggered all the time, even when I don't click on anything. And because it's constantly triggered, I can't even select things in my comboboxes as the application is too busy probably calling the event.
From what I understand this event should only be called when a node loses ore receives the focus, am I right ?
Link Posted: 09-Sep-2005 00:56
At initialization FlyGrid make focused first node in the Rows collection,
if you want handle clicks on the node you can use FlyGrid.NodeClick event.