TheSwamp
Code Red => .NET => Topic started by: cadplayer on October 05, 2015, 02:32:38 AM
-
Hello!
I would like catch an Escape-event in case I press a button "Select", the winform hides and I can select someone. But if I donīt select as I press escape-key I get a error-message.
I try it to catch the Formclosing-event, it works, but first I get Autocad-error-message and than it comes formclosing-message. Have somebody a trick to solve it better ?
-
(https://dl.dropboxusercontent.com/u/174474939/PICTURE/error.png)
I get this message if I press "Escape" in the method
try
{
PromptEntityOptions options = new PromptEntityOptions("\nSelect a Surface: ");
options.AllowNone = false;
options.SetRejectMessage("\nThe selected object is not a Surface.");
options.AddAllowedClass(typeof(CivSurface), false);
PromptEntityResult result = ed.GetEntity(options);
if (result.Status == PromptStatus.OK)
{
this.SurfaceId = result.ObjectId;
}
if (ObjectId.Null == SurfaceId)
{
ed.WriteMessage("\nNo TIN Surface object was selected.");
}
}
catch(Exception ex)
{
ed.WriteMessage("\nClose Program");
}
-
Where are you assigning SurfaceId if the promptresult is anything other than Ok?
-
Yes thatīs clear - thank you!