Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread MessageDialog SetFocus?
Wed, Nov 23 2016 10:12 PMPermanent Link

Trinione

As I migrate users onto the EWB web browser app I have noticed they keep hitting 'Enter' when ever the Message Dialog pops up. They do so thinking the Message Dialog has focus on the 'Ok' button as in their Windows apps I suppose.

Is there any way to SetFocus on the 'Ok' button so they do not have to reach for the mouse, move if about and then click on it?
Thu, Nov 24 2016 1:36 AMPermanent Link

Michael Dreher

Trinione wrote:

 // Is there any way to SetFocus on the 'Ok' button so they do not
 // have to reach for the mouse, move if about and then click on it?

You can use the DefaultButton parameter in the MessageDialog procedure to set the focus.

MessageDlg(
 'Are you sure that you want to delete this record?',
 'Please Confirm',
 mtConfirmation,
 [mbOK],
 mbOK);     // <<---------------

Michael Dreher
Sat, Dec 17 2016 8:45 AMPermanent Link

Trinione

Michael Dreher wrote:
<<<
You can use the DefaultButton parameter in the MessageDialog procedure to set the focus.

MessageDlg(
 'Are you sure that you want to delete this record?',
 'Please Confirm',
 mtConfirmation,
 [mbOK],
 mbOK);     // <<---------------
>>>


No. That does not work in EWB. The focus is not set to the OK button.
Sat, Dec 17 2016 1:49 PMPermanent Link

Raul

Globestar Systems

Team Elevate Team Elevate

On 12/17/2016 8:45 AM, Trinione wrote:
> No. That does not work in EWB. The focus is not set to the OK button.

It seems work fine here - tried  this:

MessageDlg('Delete record ?', 'Confirm Delete',mtConfirmation,[mbOK],mbOK);

and this

MessageDlg('Delete record ?', 'Confirm
Delete',mtConfirmation,[mbOK,mbCancel],mbOK);


And in all cases OK has focus and i can hit Enter to dismiss it. in case
of OK,Cancel button and i can also hit tab to move to cancel and hit
enter to dismiss that way.

Tried IE, Chrome and Firefox and all work ok.

In my case i'm calling MessageDlg from button clock handler.

Where are you calling the MessageDlg from ?

Because of async nature of the EWB/JS any chance you have some other
code running after that somehow messaes with focus.

Raul
Sat, Dec 17 2016 3:08 PMPermanent Link

Trinione

Thank you both. It does indeed work as advertised.

The issue is for form based animation I have to turn AutoFocus off. That's why it cannot set the focus in the message dialog.
Image