.NET

.NET

Reply
Contributor
16 Posts
0 Kudos
Registered: ‎01-25-2011
Post 1 of 2
Accepted Solution

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

277 Views, 1 Replies
04-13-2013 08:16 PM

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

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);

 

*Expert Elite*
2,142 Posts
254 Kudos
Registered: ‎04-29-2006
Post 2 of 2

Re : GetEntity() distinguish between "Enter" and "Esc" key p

04-13-2013 11:37 PM 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are you interested in helping shape the future of the Autodesk Community? To participate in this brief usability study, please click here. Your time and input is greatly appreciated!