wxMac: ENTER with a ShowModal() doesn't work

macdev at gmail.com macdev at gmail.com
Mon Apr 2 08:17:15 PDT 2007


Hi all,
  I have a wxDialog which pops up a wxDialog under a certain
condition, and is shown using ShowModal(). The dialog is shown
properly as a modal where I cannot press any buttons on the dialog
underneath it, but the dialog itself won't close if I press ENTER like
a wxMessageBox dialog will. I realize that the wxMessageBox code calls
a different kind of Mac dialog than wxDialog does, but ShowModal()
should allow the ENTER key to dismiss the dialog, espcially since I
set the OK button as the default and it glows blue. Is this a known
issue, or is there a sample showing a modal wxDialog that's properly
dismissable using the ENTER key? I just need to know if I'm missing
something.

			wxDialog	myDlg(this, -1, _i18n("My Dialog"), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_DIALOG_STYLE);
			wxSizer *sizer = LayoutSharedProfileTag(&sharedTagDlg, false,
false);
			myDlg.Center();
			myDlg.SetSizer(sizer);
			sizer->SetSizeHints(& myDlg);

			myDlg.ShowModal();

And in the sizer code...

    wxButton *item10 = new wxButton( parent, wxID_OK, _("OK"),
wxDefaultPosition, wxDefaultSize, 0 );
    item10->SetDefault();







More information about the wx-users mailing list