question about using ESRI.ArcGIS.Display.RubberPoint and TrackNew();

Discussion created by agslayton on Jun 6, 2012
Latest reply on Jun 7, 2012 by kenbuja
I have a custom dialog box which has a button that when pressed runs the following function:

private void getPoint(ESRI.ArcGIS.Carto.IActiveView myView)
            listenerTrial lt = new listenerTrial();
            ESRI.ArcGIS.Geometry.IPoint myPt = lt.GetPointFromClicks(myView);
            double x = myPt.X;
            double y = myPt.Y;
            string echo = x.ToString();
            this.textBox1.Text = echo;
            echo = y.ToString();
            this.textBox2.Text = echo;


The GetPointFromClicks method from the listenerTrial Class has the following code:

public ESRI.ArcGIS.Geometry.IPoint GetPointFromClicks(ESRI.ArcGIS.Carto.IActiveView activeView)

            ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;

            ESRI.ArcGIS.Display.RubberPoint ptBand = new ESRI.ArcGIS.Display.RubberPoint();
            ESRI.ArcGIS.Geometry.IGeometry geometry = ptBand.TrackNew(screenDisplay, null);

            ESRI.ArcGIS.Geometry.IPoint mPt = (ESRI.ArcGIS.Geometry.IPoint)geometry;

            return mPt;


The function returns the geometry of a point, unfortuneately, it returns the the coordinates of my mouse cursor when the button on the original dialog box was clicked. 

Any thoughts on how to get the function to wait for a click on the map (myView object)