{"id":22403,"date":"2008-05-08T10:00:00","date_gmt":"2008-05-08T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2008\/05\/08\/gentle-reminder-on-a-dialog-box-do-not-give-ok-and-cancel-accelerators\/"},"modified":"2008-05-08T10:00:00","modified_gmt":"2008-05-08T10:00:00","slug":"gentle-reminder-on-a-dialog-box-do-not-give-ok-and-cancel-accelerators","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20080508-00\/?p=22403","title":{"rendered":"Gentle reminder: On a dialog box, do not give OK and Cancel accelerators"},"content":{"rendered":"<p>\nI know most of you know this, but I&#8217;m going to say it for the record.\nWhen you have a dialog box with an OK and\/or Cancel button,\ndo not give the keys accelerators.\nIn other words, simply write\n<\/p>\n<pre>\n    DEFPUSHBUTTON \"OK\", IDOK, ...\n    PUSHBUTTON \"Cancel\", IDCANCEL, ...\n<\/pre>\n<p>\nThe dialog manager already has those buttons covered.\nThe hotkey for the OK button is Enter\n(since it is the default pushbutton),\nand the hotkey for the Cancel button is ESC\n(since its ID is <code>IDCANCEL<\/code>).\n<\/p>\n<p>\nNote of course that during the lifetime of a dialog box,\nthe default pushbutton may change,\nbut the principle still stands:\nDo not give the OK button a keyboard accelerator.\n<\/p>\n<p>\nOh, and while you&#8217;re there, don&#8217;t forget that the recommended\nminimum size for pushbuttons is 50dlu by 14dlu.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know most of you know this, but I&#8217;m going to say it for the record. When you have a dialog box with an OK and\/or Cancel button, do not give the keys accelerators. In other words, simply write DEFPUSHBUTTON &#8220;OK&#8221;, IDOK, &#8230; PUSHBUTTON &#8220;Cancel&#8221;, IDCANCEL, &#8230; The dialog manager already has those buttons covered. [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-22403","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>I know most of you know this, but I&#8217;m going to say it for the record. When you have a dialog box with an OK and\/or Cancel button, do not give the keys accelerators. In other words, simply write DEFPUSHBUTTON &#8220;OK&#8221;, IDOK, &#8230; PUSHBUTTON &#8220;Cancel&#8221;, IDCANCEL, &#8230; The dialog manager already has those buttons covered. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/22403","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=22403"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/22403\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=22403"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=22403"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=22403"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}