.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetEntity() distinguish between "Enter" and "Esc" key press

1 REPLY 1
SOLVED
Reply
Message 1 of 2
nirvanbd
1515 Views, 1 Reply

GetEntity() distinguish between "Enter" and "Esc" key press

Hi,

   I am using GetEntity() of Editor object to allow user to select a single entity. Here is the code for the same.

 

PromptEntityResult result = editor.GetEntity(new PromptEntityOptions("\nSelect Relay Entity To Query"));

The user can respond by pressing Enter key or Escape key or select the Entity. The problem is that the PromptEntityResult.Status returns the same Cancel for both the Enter and Escape key press. So my question is how do I recognize which key was pressed (Enter or Cancel) as a response to GetEntity() method.

 

thanks

Nirvan

1 REPLY 1
Message 2 of 2
_gile
in reply to: nirvanbd

Hi,

 

Using a PromptEntityOption instance, you can set its AllowNone property to true so that if the user press Enter the PromptEntityResult.Status will be None instead of Cancel.

PromptEntityOptions options = new PromptEntityOptions("\nSelect Relay Entity To Query");
options.AllowNone = true;
PromptEntityResult result = ed.GetEntity(options);

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost