[quote="Elkay"]Two comments: First, your code produces an infinate-loop since setting the Selected Node causes the NodeSelectedChange to fire - where we set it again, etc. etc. round and round.
Yes, in the NodeSelectedChange should be used a flag that indicating current state:
[VB.Net]
Private as processedNode as NodeBase
Private Sub InitializeComponent()
'.....
' to handle right selection include GridOptions.RightSelection
' option into FlyGrid.Options
Me.flyGrid.Options = flyGrid.Options Or GridOptions.RightSelection
End Sub
' NodeSelectedChange event handler
Private Sub treeviewGrid_NodeSelectedChange(ByVal sender As Object, ByVal node As NineRays.Windows.Forms.Data.NodeBase) Handles flyGrid.NodeSelectedChange
If (node.RightSelected And Not node.Equals(processedNode)) Then
processedNode = node;
Me.flyGrid.Selected = node
processedNode = Nothing;
End If
End Sub
[quote="Elkay"]
Second: It ALMOST works. This selects the right-clicked Node but then it instantly vanishes as the Selected Node for some reason.
I'm not sure why you're handling the Right-Click so differently than the Left-Click but it seems to me (about about 99.99% of the other developers out there) that Left and Right clicks should act exactly the same. If the developer wants different behavior, he/she can see which button was clicked on and take actions accordingly.
The way you have it right now, it's almost impossible to get a right-click pop-up menu without a ton of code and a ton of monkeying around. This has gone far beyond frustrating
-LK
to determine right-clicked node or use this in popup menu initialization/click code.