Home - Forums-.NET - FlyGrid.Net (Windows Forms) - NodeFocusChanging Event Questions

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

NodeFocusChanging Event Questions
Link Posted: 19-Oct-2006 17:29
Hello 9Rays:

I am trying to program the ability to stop the user from changing the selected node in a FlyGrid with one TreeViewColumn (i.e., it's a tree, really).

The only event that I can find that seems to support this abillity to intercept and cancel the node change action is NodeFocusChanging.

Two questions:

(1) Is this the way to go?

(2) Please explain the following output: why so many events and what is the general meaning of their issue and ordering?

THE NODE CHANGE IS ALLOWED:

(NodeFocusChanging (name DestinationNode) (focused False))
(NodeFocusChanging (name SourceNode) (focused True))
(NodeFocusChanging (name DestinationNode) (focused True))
(NodeFocusChanging (name DestinationNode) (focused False))

THE NODE CHANGE IS CANCELLED (by returning false from handler):

(NodeFocusChanging (name DestinationNode) (focused False))
(NodeFocusChanging (name DestinationNode) (focused False))

    Thank-you.
Link Posted: 21-Oct-2006 01:31
(1) Is this the way to go?


Yes.

(2) Please explain the following output: why so many events and what is the general meaning of their issue and ordering?

THE NODE CHANGE IS ALLOWED:

(NodeFocusChanging (name DestinationNode) (focused False))
(NodeFocusChanging (name SourceNode) (focused True))
(NodeFocusChanging (name DestinationNode) (focused True))
(NodeFocusChanging (name DestinationNode) (focused False))


This notification is send when node become to change it's focus,
when node is focused and node is unfocused.
If you need to control changes from unfocused to focused state (node become to focused), please filter this notification, as following:
[c#]
if (!node.Focused)
{
  //your code to allow or disallow focus changing
}


THE NODE CHANGE IS CANCELLED (by returning false from handler):

(NodeFocusChanging (name DestinationNode) (focused False))
(NodeFocusChanging (name DestinationNode) (focused False))

This log reflect situation when FlyGrid.Net tries to focus node when receives focus.