{"id":848,"date":"2020-08-23T10:47:00","date_gmt":"2020-08-23T16:47:00","guid":{"rendered":"https:\/\/www.great-white-software.com\/blog\/?p=848"},"modified":"2020-08-20T10:53:48","modified_gmt":"2020-08-20T16:53:48","slug":"making-keydown-events-easier-to-read","status":"publish","type":"post","link":"https:\/\/www.great-white-software.com\/blog\/2020\/08\/23\/making-keydown-events-easier-to-read\/","title":{"rendered":"Making keydown events easier to read"},"content":{"rendered":"\n<p>I frequently have to look up certain events and read what returning true and false means.<\/p>\n\n\n\n<p>I dont try to memorize this stuff any more.<\/p>\n\n\n\n<p>One thing I do is insert something like<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ this makes things semantically easier to deal with \n\/\/ and easier to read\nConst rejectKey = True\nConst acceptKey = False<\/code><\/pre>\n\n\n\n<p>into keydown handlers and then return rejectKey and acceptKey from whatever code I write. My code then reads like<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ number ?\nIf Asc(key) >= Asc(\"0\") And Asc(key) &lt;= Asc(\"9\") Then\n  Return acceptKey\nEnd If\n\/\/ permits negative numbers being entered\nIf currentCellContents = \"\" And key = \"-\" Then\n  Return acceptKey\nEnd If<\/code><\/pre>\n\n\n\n<p>and its a lot clearer what the intention is<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I frequently have to look up certain events and read what returning true and false means. I dont try to memorize this stuff any more. One thing I do is insert something like into keydown handlers and then return rejectKey and acceptKey from whatever code I write. My code then reads like and its a &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.great-white-software.com\/blog\/2020\/08\/23\/making-keydown-events-easier-to-read\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Making keydown events easier to read&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-848","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/848","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/comments?post=848"}],"version-history":[{"count":1,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/848\/revisions"}],"predecessor-version":[{"id":849,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/posts\/848\/revisions\/849"}],"wp:attachment":[{"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/media?parent=848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/categories?post=848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.great-white-software.com\/blog\/wp-json\/wp\/v2\/tags?post=848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}