<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: GripData.OnHover() how to add a context menu in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6349543#M39715</link>
    <description>&lt;P&gt;Page,&lt;/P&gt;
&lt;P&gt;using the&amp;nbsp;MultiModesGripPE class was the key to getting the context menu to auto-hide. Attached is a class showing how this works, along with 2 options for the overruled grip...one to extend from the start point of a line, the other to extend from the end point.&lt;/P&gt;</description>
    <pubDate>Wed, 25 May 2016 23:05:24 GMT</pubDate>
    <dc:creator>Jeff_M</dc:creator>
    <dc:date>2016-05-25T23:05:24Z</dc:date>
    <item>
      <title>GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667410#M39704</link>
      <description>&lt;P&gt;When grip editing a polyline, hovering over a grip shows this context menu:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/172330iF74890FCAAFDCBC0/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="poly grip menu.png" title="poly grip menu.png" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When the user moves the cursor anywhere but over the menu, the menu is removed and the cursor remains visible at all times. In my GripOverrule, adding a ContextMenu to MyGrip works the same, except the menu stays unless the user clicks elsewhere,&amp;nbsp; and the cursor is not visible unless the user manages to pass over the menu. What must I do to get the same functionality as the polyline grip menu?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a small example which adds a single grip to the endpoint of lines. The OnHover() adds a single menu item to set the line's layer to "0". None of the ContextMenuStrip's properties/events that control the display or focus, other than Show() &amp;amp; Hide(), work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.GraphicsInterface;
using Autodesk.AutoCAD.Runtime;

namespace Test_Commands.GripTest
{

    public class GripTest
    {

        private static bool ShouldBeOn = false;

        [CommandMethod("GripTestToggle")]
        public void griptestCommand()
        {
            if (ShouldBeOn)
            {
                ShouldBeOn = false;
                RemoveOverrule();
            }
            else
            {
                ShouldBeOn = true;
                AddOverrule();
            }
        }


        // Added for grips for line 
        public static TestGripsOverrule mGripOverrule;

        public static void AddOverrule()
        {
            if (ShouldBeOn)
            {
                // Instantiate our global Overrule and set it to overrule lines with my data attached
                mGripOverrule = new TestGripsOverrule();
                Overrule.AddOverrule(RXObject.GetClass(typeof(Line)), mGripOverrule, false);
                //Turn overruling on
                Overrule.Overruling = true;   
            }
        }

        public static void RemoveOverrule()
        {
            if (!ShouldBeOn)
            {
                Overrule.RemoveOverrule(RXObject.GetClass(typeof(Line)), mGripOverrule);
                mGripOverrule = null;
            }
        }
    }

    //Grip overrule to add our custom grips to the line
    public class TestGripsOverrule : GripOverrule
    {
        public static short gripcolor { get; set; }
        public static System.Windows.Forms.ContextMenuStrip mnu;

        //Our custom grip class
        //(Could have derived one class for each grip, but we'll use member data (Ordinal property) to distinguish grips instead)
        public class MyGrip : GripData
        {
            private int mGripNum;
            public int Ordinal
            {
                get { return mGripNum; }
                set { mGripNum = value; }
            }

            public override bool ViewportDraw(ViewportDraw worldDraw, ObjectId entityId, DrawType type, Point3d? imageGripPoint, int gripSizeInPixels)
            {
                Point2d unit = worldDraw.Viewport.GetNumPixelsInUnitSquare(GripPoint);
                var gripPolygonPts = new Point3dCollection();
                double lengthVal = 1.20 * gripSizeInPixels / unit.X;
                gripPolygonPts.Add(new Point3d(GripPoint.X, GripPoint.Y + lengthVal, 0));
                gripPolygonPts.Add(new Point3d(GripPoint.X + lengthVal, GripPoint.Y, 0));
                gripPolygonPts.Add(new Point3d(GripPoint.X, GripPoint.Y - lengthVal, 0));
                gripPolygonPts.Add(new Point3d(GripPoint.X - lengthVal, GripPoint.Y, 0));
                
                // Polygon properties
                worldDraw.SubEntityTraits.Color = gripcolor;
                worldDraw.SubEntityTraits.FillType = FillType.FillAlways;

                worldDraw.Geometry.Polygon(gripPolygonPts); 
                return true;
            }

            private ObjectId entId;

            public override ReturnValue OnHover(ObjectId entityId, Context contextFlags)
            {
                if(mnu==null)
                {
                    mnu = new System.Windows.Forms.ContextMenuStrip();
                    mnu.Items.Add("Set Layer 0");
                }
                entId = entityId;
                Document doc = Application.DocumentManager.MdiActiveDocument;
                System.Windows.Point pos = doc.Editor.PointToScreen(GripPoint, Convert.ToInt16(Application.GetSystemVariable("CVPORT")));
                pos.Offset(doc.Window.DeviceIndependentLocation.X + 15, doc.Window.DeviceIndependentLocation.Y + 38);
                mnu.Show(new System.Drawing.Point(Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y)));
                mnu.ItemClicked += mnu_ItemClicked;
                return base.OnHover(entityId, contextFlags);
            }

            void mnu_ItemClicked(object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e)
            {
                mnu.Hide();
                Document doc = Application.DocumentManager.MdiActiveDocument;
                using (DocumentLock doclock = doc.LockDocument())
                {
                    Line line = (Line)entId.Open(OpenMode.ForWrite);
                    line.Layer = "0";
                    line.Close();
                }
                mnu.ItemClicked -= mnu_ItemClicked;
            }

        }

        //Array to hold our grip
        public GripData[] mGripData = new GripData[1];

        public override void GetGripPoints(Autodesk.AutoCAD.DatabaseServices.Entity entity, Autodesk.AutoCAD.DatabaseServices.GripDataCollection grips, double curViewUnitSize, int gripSize, Autodesk.AutoCAD.Geometry.Vector3d curViewDir, Autodesk.AutoCAD.DatabaseServices.GetGripPointsFlags bitFlags)
        {
            //We assume entity is a line
            Line line = entity as Line;

            if (line == null)
                return;
            gripcolor = (short)Application.GetSystemVariable("GRIPHOT");

            // Set point at end of line
            MyGrip grip = new MyGrip();
            grip.Ordinal = 0;
            
            mGripData[0] = grip;

            UpdateGripLocations(line);

            //Add our grips to the list
            foreach (MyGrip g in mGripData)
            {
                grips.Add(g);
            }

            //Get the standard line grip points as well, but not wanted for this test
            //base.GetGripPoints(entity, grips, curViewUnitSize, gripSize, curViewDir, bitFlags);            
        }

        public override void MoveGripPointsAt(Autodesk.AutoCAD.DatabaseServices.Entity entity, GripDataCollection grips,
                                              Vector3d offset, MoveGripPointsFlags bitFlags)
        {
            //We only take  action when we get this call on a database resident entity
            //Dragging operation makes shallow clone of line, and setting clomeMeForDragging to false is generally a bad idea.
            //(If you do set clone me for dragging to false, then don't call base class overriden methods).
            try
            {
                if (entity.Id.IsValid)
                {
                    var line = entity as Line;

                    //Iterate through list of all grips being moved
                    foreach (GripData g in grips)
                    {
                        if (g is MyGrip)
                        {
                            MyGrip grip = g as MyGrip;
                            //Cast to our grip type
                            double newX = g.GripPoint.X + offset.X;
                            double newY = g.GripPoint.Y + offset.Y;

                            switch (grip.Ordinal)
                            {
                                case 0:
                                    line.EndPoint = new Point3d(newX, newY, line.EndPoint.Z);
                                    break;
                                default:
                                    break;
                            }

                            //Tell grip to move itself long the line
                            UpdateGripLocations(line);
                        }
                    }
                }
            }
            catch (System.Exception)
            {

            }
        }

        private void UpdateGripLocations(Line line)
        {
            Point3d pt = new Point3d(line.EndPoint.X, line.EndPoint.Y, 0);
            mGripData[0].GripPoint = pt;
        }

    }
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 17:21:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667410#M39704</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2015-06-06T17:21:36Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667494#M39705</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;hi Jeff!, look at the sample provided by Balaji Ram here:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;A href="http://forums.autodesk.com/t5/objectarx/how-to-handle-ctrl-click-in-move-grip-point/td-p/3725552" target="_blank"&gt;http://forums.autodesk.com/t5/objectarx/how-to-handle-ctrl-click-in-move-grip-point/td-p/3725552&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;you need to implement the&amp;nbsp;MultiModesGripPE class, Balaji sample covers that in .NET.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;hth.-&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 22:51:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667494#M39705</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-06T22:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667516#M39706</link>
      <description>Thanks, Luis! I've been searching for an example like this for a few days. I think this also will help to solve an issue I posted about on the Swamp yesterday.</description>
      <pubDate>Sun, 07 Jun 2015 00:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667516#M39706</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2015-06-07T00:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667518#M39707</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;hi Jeff, good! -- got the chance to play a little bit with Balaji's sample, and did some refactoring, on this one, it simple will extend the start point of a line, see if helps:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;    public class JeffMoverrule
    {
        private static readonly Overrule[] Overrules =
        {
            new DrawOverrule(), new PropsOverrule(), new XformOverrule(),
            new ObjectSnapOverrule(), new GripPointOverrule(), new HiliteOverrule(), new ObjOverrule()
        };

        private static readonly List&amp;lt;ObjectId&amp;gt; OverruledObjects = new List&amp;lt;ObjectId&amp;gt;();
        private const string RegAppName = "JeffMoverrule";
        private static bool _overruleAdded;

        [CommandMethod("GRIPMENU")]
        public static void cmd_gripMenu()
        {
            var document = AcadApp.DocumentManager.MdiActiveDocument;
            var editor = document.Editor;

            const string classType = "line";
            var options = new PromptEntityOptions(string.Format("Select {0} to overrule", classType));
            options.SetRejectMessage(string.Format("Selected object is not a {0}!", classType));
            options.AddAllowedClass(typeof (Line), true);

            var getLine = editor.GetEntity(options);
            if (getLine.Status != PromptStatus.OK) return;

            if (getLine.ObjectId.ObjectClass != RXObject.GetClass(typeof (Line)))
            {
                editor.WriteMessage("Selected object is not a line!\n");
                return;
            }

            if (OverruledObjects.Count == 0)
            {
                AcadApp.DocumentManager.DocumentToBeDestroyed += DocumentManager_DocumentToBeDestroyed;
            }

            if (!OverruledObjects.Contains(getLine.ObjectId))
            {
                var database = getLine.ObjectId.Database;
                using (var transaction = database.TransactionManager.StartTransaction())
                {
                    var regAppTable =
                        (RegAppTable) transaction.GetObject(database.RegAppTableId, OpenMode.ForRead, false);
                    if (!regAppTable.Has(RegAppName))
                    {
                        var regAppTableRecord = new RegAppTableRecord {Name = RegAppName};
                        regAppTable =
                            (RegAppTable) transaction.GetObject(database.RegAppTableId, OpenMode.ForWrite, false);
                        regAppTable.Add(regAppTableRecord);
                        transaction.AddNewlyCreatedDBObject(regAppTableRecord, true);
                    }

                    var line = (Line) transaction.GetObject(getLine.ObjectId, OpenMode.ForRead);
                    if (line.GetXDataForApplication(RegAppName) == null)
                    {
                        line = (Line) transaction.GetObject(getLine.ObjectId, OpenMode.ForWrite);
                        line.XData = new ResultBuffer(new TypedValue((int) DxfCode.ExtendedDataRegAppName, RegAppName),
                            new TypedValue((int) DxfCode.ExtendedDataReal, 0.0));
                        OverruledObjects.Add(getLine.ObjectId);
                    }
                    transaction.Commit();
                }
            }
            var ids = OverruledObjects.ToArray();
            foreach (var overrule in Overrules)
            {
                overrule.SetIdFilter(ids);
                if (!_overruleAdded)
                {
                    Overrule.AddOverrule(RXObject.GetClass(typeof (Line)), overrule, false);
                }
            }
            _overruleAdded = true;
            AcadApp.DocumentManager.MdiActiveDocument.Editor.Regen();
        }

        private static void DocumentManager_DocumentToBeDestroyed(object sender, DocumentCollectionEventArgs e)
        {
            for (var i = OverruledObjects.Count - 1; i &amp;gt;= 0; i--)
                if (OverruledObjects[i].Database == e.Document.Database)
                    OverruledObjects.RemoveAt(i);
            var ids = OverruledObjects.ToArray();
            foreach (var overrule in Overrules)
                overrule.SetIdFilter(ids);
        }

        private static LineSegment3d[] GetPointsLocations(Line line)
        {
            var lines = new LineSegment3d[1];
            var segment = new LineSegment3d(line.StartPoint, line.EndPoint);
            var vector = segment.Direction.MultiplyBy(-(segment.Length/3.0));
            lines[0] = new LineSegment3d(segment.StartPoint.Subtract(vector), segment.EndPoint.Add(vector));
            return lines;
        }

        private class DrawOverrule : DrawableOverrule
        {
            public override bool WorldDraw(Drawable drawable, WorldDraw worldDraw)
            {
                return base.WorldDraw(drawable, worldDraw);
            }
        }

        private class PropsOverrule : PropertiesOverrule
        {
            public override void List(Entity entity)
            {
            }
        }

        private class XformOverrule : TransformOverrule
        {
            public override void Explode(Entity entity, DBObjectCollection entitySet)
            {
            }
        }

        private class LineOverruled : MultiModesGripPE
        {
            public override GripMode CurrentMode(Entity entity, GripData gripData)
            {
                var grip = gripData as GripPointOverrule.MyGrip;
                if (grip == null) return null;
                var index = (int) grip.CurrentModeId - (int) GripMode.ModeIdentifier.CustomStart;
                return grip.Modes[index];
            }

            public override uint CurrentModeId(Entity entity, GripData gripData)
            {
                var grip = gripData as GripPointOverrule.MyGrip;
                if (grip != null) return (uint) grip.CurrentModeId;
                return 0;
            }

            public override bool GetGripModes(Entity entity, GripData gripData, GripModeCollection modes,
                ref uint curMode)
            {
                if (!(gripData is GripPointOverrule.MyGrip)) return false;
                return ((GripPointOverrule.MyGrip) gripData).GetGripModes(ref modes, ref curMode);
            }

            public override GripType GetGripType(Entity entity, GripData gripData)
            {
                return (gripData is GripPointOverrule.MyGrip) ? GripType.Secondary : GripType.Primary;
            }

            public override void Reset(Entity entity)
            {
            }

            public override bool SetCurrentMode(Entity entity, GripData gripData, uint curMode)
            {
                if (!(gripData is GripPointOverrule.MyGrip)) return false;
                ((GripPointOverrule.MyGrip) gripData).CurrentModeId = (GripMode.ModeIdentifier) curMode;
                return true;
            }
        }

        private class GripPointOverrule : GripOverrule
        {
            internal GripPointOverrule()
            {
                var theOverruled = new LineOverruled();
                GetClass(typeof (Line)).AddX(GetClass(typeof (LineOverruled)), theOverruled);
            }

            internal abstract class MyGrip : GripData
            {
                protected MyGrip()
                {
                    _gripModeCollection = new GripModeCollection();
                }

                private GripMode.ModeIdentifier _curModeId = GripMode.ModeIdentifier.CustomStart;

                public virtual GripMode.ModeIdentifier CurrentModeId
                {
                    get { return _curModeId; }
                    set { _curModeId = value; }
                }

                private readonly GripModeCollection _gripModeCollection;
                private const short Color = 2;

                public virtual GripModeCollection Modes
                {
                    get { return _gripModeCollection; }
                }

                public abstract void Extend(Entity entity, Vector3d offset);

                public abstract bool GetGripModes(ref GripModeCollection modes, ref uint curMode);

                public override bool ViewportDraw(ViewportDraw viewportDraw, ObjectId entityId, DrawType type,
                    Point3d? imageGripPoint, int gripSize)
                {
                    var unit = viewportDraw.Viewport.GetNumPixelsInUnitSquare(GripPoint);

                    var gripPolygonPts = new Point3dCollection();
                    var lengthVal = 1.20*gripSize/unit.X;
                    gripPolygonPts.Add(new Point3d(GripPoint.X, GripPoint.Y + lengthVal, 0));
                    gripPolygonPts.Add(new Point3d(GripPoint.X + lengthVal, GripPoint.Y, 0));
                    gripPolygonPts.Add(new Point3d(GripPoint.X, GripPoint.Y - lengthVal, 0));
                    gripPolygonPts.Add(new Point3d(GripPoint.X - lengthVal, GripPoint.Y, 0));

                    viewportDraw.SubEntityTraits.Color = Color;
                    viewportDraw.SubEntityTraits.FillType = FillType.FillAlways;

                    viewportDraw.Geometry.Polygon(gripPolygonPts);
                    return true;
                }

                protected void ExtendEndPoint(Entity entity, Vector3d offset)
                {
                    var line = (Line) entity;
                    var gripPoint = GripPoint + offset;
                    var length = gripPoint.DistanceTo(line.StartPoint);// + line.Length / 3.0;
                    using (var seg = new LineSegment3d(line.StartPoint, line.EndPoint))
                    {
                        var vec = seg.Direction.MultiplyBy(length);
                        using (var segment = new LineSegment3d(seg.StartPoint.Subtract(vec), seg.EndPoint.Add(vec)))
                        {
                            line.StartPoint = segment.StartPoint;
                        }
                    }
                }
            }

            private class LengthThirdFractionGrip : MyGrip
            {
                public override bool GetGripModes(ref GripModeCollection modes, ref uint curMode)
                {
                    var gripMode = new GripMode
                    {
                        ModeId = 0,
                        DisplayString = "Extend Start Point Third Of The Line Length...",
                        Action = GripMode.ActionType.Immediate
                    };
                    modes.Add(gripMode);
                    return true;
                }

                public override void Extend(Entity entity, Vector3d offset)
                {
                    ExtendEndPoint(entity, offset);
                }
            }

            private readonly GripData[] _grips = new GripData[1];

            public override void GetGripPoints(Entity entity, GripDataCollection grips, double curViewUnitSize,
                int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags)
            {
                base.GetGripPoints(entity, grips, curViewUnitSize, gripSize, curViewDir, bitFlags);

                var line = (Line) entity;
                var lines = GetPointsLocations(line);
                _grips[0] = new LengthThirdFractionGrip {GripPoint = lines[0].EndPoint};

                foreach (var grip in _grips)
                    grips.Add(grip);
            }

            public override void MoveGripPointsAt(Entity entity, GripDataCollection grips, Vector3d offset,
                MoveGripPointsFlags bitFlags)
            {
                foreach (var grip in grips)
                {
                    var myGrip = grip as MyGrip;
                    if (myGrip != null)
                        myGrip.Extend(entity, offset);
                    else
                        base.MoveGripPointsAt(entity, grips, offset, bitFlags);
                }
            }
        }

        private class ObjectSnapOverrule : OsnapOverrule
        {
            public override void GetObjectSnapPoints(Entity entity, ObjectSnapModes snapMode, IntPtr gsSelectionMark,
                Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints,
                IntegerCollection geometryIds)
            {
                base.GetObjectSnapPoints(entity, snapMode, gsSelectionMark, pickPoint, lastPoint, viewTransform,
                    snapPoints, geometryIds);
                if ((snapMode &amp;amp; ObjectSnapModes.ModeEnd) != ObjectSnapModes.ModeEnd) return;

                var line = (Line) entity;
                var locations = GetPointsLocations(line);
                foreach (var location in locations)
                {
                    //snapPoints.Add(l.StartPoint);
                    snapPoints.Add(location.EndPoint);
                }
            }
        }

        private class HiliteOverrule : HighlightOverrule
        {
        }

        private class ObjOverrule : ObjectOverrule
        {
            public override void Erase(DBObject dbObject, bool erasing)
            {
                base.Erase(dbObject, erasing);
                if (erasing)
                    throw new Autodesk.AutoCAD.Runtime.Exception(ErrorStatus.CannotBeErasedByCaller);
            }
        }
    }
&lt;/PRE&gt;</description>
      <pubDate>Sun, 07 Jun 2015 01:09:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5667518#M39707</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-07T01:09:19Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5670298#M39708</link>
      <description>&lt;P&gt;Thanks again, Luis! It took a mix of the DevDay and your examples to get this, but it's now working just as I had expected it to. I never wuld've figured it out without your help, much appreciated!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="iframe-container"&gt;&lt;IFRAME src="https://screencast.autodesk.com/Embed/Timeline/1S1ynR4" width="640" height="590" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen" webkitallowfullscreen="webkitallowfullscreen" style="display: inline;"&gt;&lt;/IFRAME&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Jun 2015 15:22:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5670298#M39708</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2015-06-09T15:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5670433#M39709</link>
      <description>&lt;P&gt;&lt;FONT face="courier new,courier"&gt;those are great news Jeff, glad&amp;nbsp;i helped.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;take care! - luis.-&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2015 16:33:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/5670433#M39709</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-09T16:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6293482#M39710</link>
      <description>&lt;P&gt;Hi Luis/Jeff,&lt;/P&gt;&lt;P&gt;Great POst ,&lt;/P&gt;&lt;P&gt;I searched everywehre for an example for this.&lt;/P&gt;&lt;P&gt;it works great.&lt;/P&gt;&lt;P&gt;I have one question thought, How can I add one more item to menu.&lt;/P&gt;&lt;P&gt;would you mind to trim your code to show a list box with 2 items please.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2016 14:52:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6293482#M39710</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2016-04-26T14:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6294534#M39711</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/864158"&gt;@JanetDavidson﻿&lt;/a&gt;, you basically just need to add GripData for each entry you want to see in the contect menu.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var gripMode = new GripMode
{
ModeId = 0,
DisplayString = "Extend Start Point Third Of The Line Length...",
Action = GripMode.ActionType.Immediate
};
modes.Add(gripMode);
//next one
gripMode = new GripMode
{
ModeId = 1,
DisplayString = "Something else to display.",
Action = GripMode.ActionType.Immediate
};
modes.Add(gripMode);
//etc&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Apr 2016 22:22:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6294534#M39711</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-04-26T22:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6296623#M39712</link>
      <description>&lt;P&gt;Hello Jeff,&lt;/P&gt;&lt;P&gt;Thanks for looking in this for me.&lt;/P&gt;&lt;P&gt;I did exactly what you said and &amp;nbsp;now in context menu it shows two items.&lt;/P&gt;&lt;P&gt;But how can I assign a different task for second item ?&lt;/P&gt;&lt;P&gt;Let's say the second item should change the layer of line to something else?&lt;/P&gt;&lt;P&gt;That part is the tricky part.&lt;/P&gt;&lt;P&gt;Funny is, right now after I added the second item, when I click on it , it will extend the line , like I clicked the first item.&lt;/P&gt;&lt;P&gt;I really got confused with this grip overrule.&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Janet.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2016 21:32:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6296623#M39712</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2016-04-27T21:32:52Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6297042#M39713</link>
      <description>Yes, it took me some time to get mine figured out and working as I wanted. I think I need to create a small example, for my own benefit as well as something I can share. My benefit because it's been 10 months since I was working on that and am a bit confused myself as I look through the code. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Not sure how soon I can get to that though.</description>
      <pubDate>Thu, 28 Apr 2016 03:17:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6297042#M39713</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-04-28T03:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6348964#M39714</link>
      <description>&lt;P&gt;Hello Jeff, thanks for your helpful example. Have you find the way to make the context menu auto&amp;nbsp;hide ?&amp;nbsp;Do you have a final solution for grip menu? I am looking forward to your update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Page.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 17:17:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6348964#M39714</guid>
      <dc:creator>sdphg</dc:creator>
      <dc:date>2016-05-25T17:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6349543#M39715</link>
      <description>&lt;P&gt;Page,&lt;/P&gt;
&lt;P&gt;using the&amp;nbsp;MultiModesGripPE class was the key to getting the context menu to auto-hide. Attached is a class showing how this works, along with 2 options for the overruled grip...one to extend from the start point of a line, the other to extend from the end point.&lt;/P&gt;</description>
      <pubDate>Wed, 25 May 2016 23:05:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6349543#M39715</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-05-25T23:05:24Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6349719#M39716</link>
      <description>&lt;P&gt;Jeff,&lt;/P&gt;&lt;P&gt;You are the hero.&lt;/P&gt;&lt;P&gt;Thanks a lot .&lt;/P&gt;&lt;P&gt;believe it or not I was struggling with this all these days.&lt;/P&gt;&lt;P&gt;works like a charm.&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;LI-SPOILER&gt;&lt;LI-SPOILER&gt;Janet.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI-SPOILER&gt;&lt;/LI-SPOILER&gt;</description>
      <pubDate>Thu, 26 May 2016 02:45:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6349719#M39716</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2016-05-26T02:45:22Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6350137#M39717</link>
      <description>&lt;DIV&gt;Great work!&lt;BR /&gt;Thank you Jeff, this will help lots of people.&lt;BR /&gt;BTW, I found a way to auto-hide the context menu. After try some context menu events, I found the MouseLeave can do the hide job, I add some code like below:&lt;/DIV&gt;&lt;DIV&gt;&lt;PRE&gt;//add event handler
mnu.MouseLeave += Mnu_MouseLeave; 

//in the handler
private void Mnu_MouseLeave(object sender, EventArgs e)
{
 System.Windows.Forms.ContextMenuStrip mnu = sender as System.Windows.Forms.ContextMenuStrip;
 mnu.Hide();
}&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;when the mouse leave the context menu, the menu auto-hide, so far so good.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I chose your context menu solution, becasue I have some additional requirements, and I don't know if the MultiModesGripPE can meets. Here are my requirements:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. I need sub menu, not only one level menu.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;2. I need more than one grip point, and each of them show different context menu.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't have much time to go deep in MultiModesGripPE scenario, so I think the context menu is more flexible and much easier to understand.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I don't know if the context menu scenario has disadvantages compare to MultiModesGripPE, as I said, so far so good.&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards.&lt;/DIV&gt;&lt;DIV&gt;Page.&lt;/DIV&gt;</description>
      <pubDate>Thu, 26 May 2016 11:01:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6350137#M39717</guid>
      <dc:creator>sdphg</dc:creator>
      <dc:date>2016-05-26T11:01:52Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6351193#M39718</link>
      <description>1. No, no submenus that I can find.&lt;BR /&gt;2. I believe this would be possible, but if you need 1., too, then it's a moot point.</description>
      <pubDate>Thu, 26 May 2016 19:26:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/6351193#M39718</guid>
      <dc:creator>Jeff_M</dc:creator>
      <dc:date>2016-05-26T19:26:35Z</dc:date>
    </item>
    <item>
      <title>Re: GripData.OnHover() how to add a context menu</title>
      <link>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/7148651#M39719</link>
      <description>&lt;P&gt;Hi Jeff,&lt;/P&gt;
&lt;P&gt;I am wondering if this routine could be applied to Associative Arrays?&lt;/P&gt;
&lt;P&gt;Is it feasible ?&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Janet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 13:19:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/gripdata-onhover-how-to-add-a-context-menu/m-p/7148651#M39719</guid>
      <dc:creator>JanetDavidson</dc:creator>
      <dc:date>2017-06-13T13:19:46Z</dc:date>
    </item>
  </channel>
</rss>

