.NET

Reply
Contributor
nirvanbd
Posts: 16
Registered: ‎01-25-2011
Message 1 of 2 (238 Views)
Accepted Solution

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

238 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*
_gile
Posts: 2,086
Registered: ‎04-29-2006
Message 2 of 2 (219 Views)

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
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.