NullRefException in GoToolDragging.Start

I’m getting an error message:
An unhandled exception of type ‘System.NullReferenceException’ occurred in northwoods.go.dll (version 2.2.2.1)
Additional information: Object reference not set to an instance of an object.
The stack trace is:
northwoods.go.dll!Northwoods.Go.GoToolDragging.S tart() + 0x236 bytes
northwoods.go.dll!Northwoods.Go.GoView.set_Tool( Northwoods.Go.IGoTool value = {Northwoods.Go.GoToolDragging}) + 0x87 bytes
northwoods.go.dll!Northwoods.Go.GoToolManager.Do MouseMove() + 0xd5 bytes
northwoods.go.dll!Northwoods.Go.GoView.DoMouseMo ve() + 0x24 bytes
northwoods.go.dll!Northwoods.Go.GoView.OnMouseMo ve(System.Windows.Forms.MouseEventArgs evt = {X=456 Y=160 Button=Left}) + 0x13b bytes
This happens when the user clicks on a GoGroup object in a GoView which selects the object, then drags outside the object to unselect, then attempts to drag within the unselected object. I’m working on creating a sample app to demonstrate this, but thought that someone may have seen something similar and be able to shed a little light. allowMove in the default layer is set to false in the View.

I don’t think we have seen this exception before. Are you saying that there is no selected object (i.e. GoView.Selection is empty) during the call to GoToolDragging.Start?

That is correct. The GoView.Selection is empty within the call to GoToolDragging.Start.

Well, it does assume there is something selected that the dragging tool should be dragging. Is there a reason you want to try to drag nothing?
It isn’t clear to me how you could come up with this scenario, since you haven’t overridden any GoToolDragging methods, have you? Or is GoView.ExternalDragDropsOnEnter true and you have overridden GoView.DoExternalDrop not to select the objects that are added from the drop?

Also, note that if the user clicks on a GoGroup object in a GoView, selecting the object, then clicks outside the object instead of dragging to unselect the object, then drags within an object to select it, no exception occurs.
Also, if no object is selected, and then the user drags outside any objects and then drags inside an object to select it, then no exception occurs.
So the exception occurs only when dragging outside any objects when there is something already selected, and then dragging inside an object when there is nothing selected.
BTW, in case you think my users are addled, this user behavior occurs because my application is a TabletPC app, and the users are selecting by tapping with a stylus which is sometimes interpreted as a mini-drag.

No, I haven’t overridden any GoToolDragging methods nor am I supporting ExternalDrop.

I wonder if you need to increase the distance needed to be interpreted as a drag. In version 2.3, you can increase the size of the GoTool.DragSize property.
But perhaps something else is involved. The TabletPC usage is probably significant.

Mea Culpa. My code is the culprit. I was monkeying with the GoSelection in an attempt to provide multiselection capabilities for TabletPC users.
But perhaps someone knows of another way to enable multiselection. Currently, multiselection in a GoView is achieved by holding down the control key and then clicking on the individual GoObjects with the mouse. Having only a stylus and no keyboard, TabletPC users do not have the control key to indicate multiselection. They can drag a selection box around a group of contiguous GoObjects to do multiselection, but non-contiguous objects are a problem. Any ideas?

Actually, extending the selection is normally done with a Shift-click, since a Control-click might accidentally deselect an already selected object if the click point is slightly off target.
Perhaps you could use one of the stylus buttons? Or (shudder) have a separate mode for multi-selection?

With regard to implementing multiple selection, any suggestions about how to override the default mouse click behavior of unselecting previously selected objects?

I’m not sure what situation you are concerned about–the functionality is in GoTool.DoSelect, which you can override in your own GoToolSelecting-derived tool.