Posts: 16
Registered: ‎01-25-2011
Message 1 of 2 (215 Views)
Accepted Solution

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

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


   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.




*Expert Elite*
Posts: 2,077
Registered: ‎04-29-2006
Message 2 of 2 (196 Views)

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

04-13-2013 11:37 PM in reply to: nirvanbd



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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community