60001897 Ability to filter points tha user inputs with the mouse on active commands

Article 60001897
Type Wish
Product Engine
Date Added 1/29/2013 12:00:00 AM
Fixed (1/29/2013 12:00:00 AM)
Submitted by Marcelo Hosan

Summary

Is it possible to filter points tha user inputs with the mouse on active commands ? For example I don't I want the use to select points outside a region or a box.

Solution

In 6025 version, if you pass null as the reference gPoint then the command doesn't finish, but it asks the user for another point. This way you can filter out points that you don't like (like outside a region or a box). See the C# code below:

        void doc_FilterActionPoint(object sender, object action, ref gPoint pt)
        {
            Box bx = doc.Limits; // using Document's Limits property
            // here you can also use a region defined by you or user. You need to check with IsPointInside like:
            // VectorDraw.Render.Region reg = new VectorDraw.Render.Region(bx);        
            // if (!reg.IsPointInside(pt))
            // {
            //     //do things
            //     doc.Prompt("\r\nPoint outside region. Please input another point"); doc.Prompt(null); // notify the user for the invalid point
            //     pt = null; // pass null as the ref point pt so the command doesn't end.
            // }
            if (!bx.PointInBox(pt))
            {
                doc.Prompt("\r\nPoint outside limits. Please input another point"); doc.Prompt(null); // notify the user for the invalid point
                pt = null; // pass null as the ref point pt so the command doesn't end.
            }
        }

Send comments on this topic.