focus to mbno

palabros used Ask the Experts™
i want the focus to mbno in messagedlg box
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Mohammed NasmanSoftware Developer


  I think that's not possible with MessageDlg, use MessageBox instead of it

    MessageBox(Handle,' Do you want to exist', 'warning', MB_YesNoCancel + MB_DefButton2 + MB_ICONInformation);

  refer to win 32 sdk help for more information

Best regards
Mohammed Nasman

Create your MessageBox with :

CreateMessageDialog(const Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons): TForm;

You get back the Form from the MessageBox. Then you can iterate over the Buttons (Components) on the Form.
The Buttons are Named like: ButtonNames: array[TMsgDlgBtn] of string = ('Yes', 'No', 'OK', 'Cancel', 'Abort', 'Retry', 'Ignore', 'All', 'NoToAll',
    'YesToAll', 'Help');

If you have retrieved the Button likely with:
btn := BoxForm.FindComponent('CANCEL');
you can call btn.SetFocus;

At least you must show the Dialog with Showmodal!

HTH Frank

This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial