Node Navigation


Is it possible to nevigate the nodes in GoView through keyboard. What i did is , ALLOWKEY=True. But the nevigation is not happening. When i hit the ARROW key, the GoView ScrollBars are nevigating not the GoView Nodes.

I have Scrollbars(H & V) activated. Please let me know the solution as soon as possible.

There’s no “move selection by arrowkey” built in to GoDiagram.

This note gives the basics of the mechanism for

Using the Tab key to navigate text in a GoGroup

but you’ll have to write some code for detecting the closest object in the desired direction. (this tends to be very application specific is the reason there’s no default implementation.)

You’ll have to enable GoViewDisableKeys.ArrowMove to get the keys delivered.

Actually, enabling ArrowMove in GoView.DisableKeys will permit the user to move the objects in the current selection in the direction of the arrow keys. This is documented in the User Guide and in the help.

If you want to change what object is currently selected, you’ll need to do what Jake described above.

GoView in GoDiagram Win (and Express) always receives the arrow keys. However, if you use the ReducedTrust version of the DLL, it does not, due to security/permission issues.

Can i get sample code for detecting the closest object in the desired direction??

Like I said earlier, this tends to be very application specific. What might feel “right” for one sort of graphics or diagram might not for another. (for example, if the graph was a “tree”, it might make more sense to always go to the leftmost “leaf” on a down-arrow, even if that node isn’t the closest.) Generic code I could give you wouldn’t even know there was a tree there, much less which way it was oriented.

I’ll echo what Jake said.

Still, if you just want to do a “physical” search rather than a logical one, one possibility is to use GoDocument.PickObject at various points along the direction that you want to go.

If you need to deal with overlapping objects, you may want to use GoDocument.PickObjects instead.

Finally, instead of picking at particular points, you can use GoDocument.PickObjectsInRectangle.


We do have the graph in the form of TREE which is oriented from L - R . please provide the code.

This works in the TreeApp sample. It’s not complete. It handles Right/Left/Down, at least to some degree. I’m not saying it’s perfect, but it is all I have time for right now.

Install this tool by doing this:

goView1.Tool = goView1.DefaultTool = new KeyManager(goView1);

  public class KeyManager : GoToolManager {
    public KeyManager(GoView v) : base(v) { }
    public override void DoKeyDown() {
      TreeAppNode node = this.View.Selection.Primary as TreeAppNode;
      if (node != null && this.LastInput.Key == Keys.Right) {
        if (node.Destinations.Count > 0) {
          TreeAppNode o = node.Destinations.First as TreeAppNode;
      else if (node != null && this.LastInput.Key == Keys.Left) {
        if (node.Sources.Count > 0) {
          TreeAppNode o = node.Sources.First as TreeAppNode;
        else if (node != null && this.LastInput.Key == Keys.Down) {
          if (node.Sources.Count > 0) {
            TreeAppNode o = node.Sources.First as TreeAppNode;
            bool found = false;
            foreach (TreeAppNode t in o.Destinations) {
              if (found) {
                o = t;
              if (t == node) found = true;
      } else {