You don't need to do anything special to achieve this. A dialog will close 
automatically with a result of true when the user presses Enter. It closes with 
a result of false when the user presses Escape. 

You could use styles to highlight the OK button as the "default".

On Oct 27, 2011, at 2:31 PM, Piotr Kołaczkowski wrote:

> Hi,
> 
> I want to do a really very simple thing - a dialog box with a form in it and 
> two buttons: OK and Cancel. I want the OK button to be pressed by default 
> when user hits the Return (Enter) key and Cancel when the user presses Esc. 
> Additionally, the OK button should be somehow highlighted (e.g. different 
> color or border), so that the user knows this is the default. Is there some 
> builtin support in Pivot for doing this, or do I have to do it manually, by 
> programming all the events, etc? This is probably a very common case, and as 
> far as I remember, even Delphi in year 1998 had something like that - it was 
> just as simple as setting the DialogBox mode to "modal" and assigning each 
> button a modal-result.
> 
> Regards,
> PK
> 

Reply via email to