{"id":18573,"date":"2009-04-13T10:00:00","date_gmt":"2009-04-13T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2009\/04\/13\/why-is-there-no-support-in-the-window-manager-for-mouse-button-chording\/"},"modified":"2009-04-13T10:00:00","modified_gmt":"2009-04-13T10:00:00","slug":"why-is-there-no-support-in-the-window-manager-for-mouse-button-chording","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20090413-00\/?p=18573","title":{"rendered":"Why is there no support in the window manager for mouse button chording?"},"content":{"rendered":"<p><P>\nCommenter Nekto2 asks\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/pages\/407234.aspx#550430\">\nwhy there is no mouse action associated with &#8220;click both\nbuttons at the same time&#8221;<\/A>.\n<\/P>\n<P>\nThe window manager doesn&#8217;t fire a special event for <I>both mouse\nbuttons held down simultaneously<\/I> like it does for\ndouble-clicks.\nAs with higher-order clicks,\nmouse chording is something that you have to put together yourself\nfrom the basic mouse events that the window manager generates.\nAdd these lines to our\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2003\/07\/23\/54576.aspx\">\nscratch program<\/A>:\n<\/P>\n<PRE>\nvoid OnButtonDown(HWND hwnd, BOOL fDoubleClick,\n                  int x, int y, UINT keyFlags)\n{\n  if ((keyFlags &amp; (MK_LBUTTON | MK_RBUTTON)) ==\n                      (MK_LBUTTON | MK_RBUTTON))\n  {\n    MessageBeep(IDOK);\n  }\n}<\/p>\n<p>\/\/ Add to WndProc\n    HANDLE_MSG(hwnd, WM_LBUTTONDOWN, OnButtonDown);\n    HANDLE_MSG(hwnd, WM_RBUTTONDOWN, OnButtonDown);\n<\/PRE>\n<P>\nWhen you run this program, it beeps when both the left and right\nmouse buttons are pressed.\n<\/P>\n<P>\nNote that the program does not require the two button presses take\nplace simultaneously.\nMost people do not have the dexterity to push the two buttons at\nprecisely the same instant in time.\n(Especially since Einstein taught us that simultaneity is relative\nanyway.)\n<\/P>\n<P>\nWhy don&#8217;t more programs use chording?\n<\/P>\n<P>\nRecall that the semantics of double-clicking should be an extension\nof the single-click so that your program can perform the single-click\naction immediately (providing positive feedback to the user that\nthe click was recognized), and then continue to the double-click action\nif a second click comes in.\nFor example, a common pattern is for\nthe single-click to select the clicked-on item and the\ndouble-click to launch it.\nYou can stop at the first click and the result still makes sense.\nFor chords, you have to have <I>two<\/I> stopping points,\none if the user left-clicks and stops, and another if the user\nright-clicks and stops.\nComing up with a chord action that is compatible with both\nstopping points requires more effort.\n<\/P>\n<P>\nAnother reason why many people choose to avoid chords in their\nuser interface design is that\nchording requires more dexterity,\nand many users simply don&#8217;t have the fine motor control necessary\nto pull it off without accidentally invoking some other action\n(such as a drag).\nChording is also cumbersome to emulate with MouseKeys,\nso you run afoul of accessibility issues.\n<\/P>\n<P>\nStill, there&#8217;s nothing technically preventing you from using\nchording in your program.\nIf you want to code it up, then more power to you.\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Commenter Nekto2 asks why there is no mouse action associated with &#8220;click both buttons at the same time&#8221;. The window manager doesn&#8217;t fire a special event for both mouse buttons held down simultaneously like it does for double-clicks. As with higher-order clicks, mouse chording is something that you have to put together yourself from the [&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":[26],"class_list":["post-18573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>Commenter Nekto2 asks why there is no mouse action associated with &#8220;click both buttons at the same time&#8221;. The window manager doesn&#8217;t fire a special event for both mouse buttons held down simultaneously like it does for double-clicks. As with higher-order clicks, mouse chording is something that you have to put together yourself from the [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/18573","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=18573"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/18573\/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=18573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=18573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=18573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}