{"id":9631,"date":"2015-08-17T06:00:00","date_gmt":"2015-08-17T13:00:00","guid":{"rendered":"https:\/\/www.sapien.com\/blog\/?p=9631"},"modified":"2015-09-17T09:41:35","modified_gmt":"2015-09-17T16:41:35","slug":"typing-enter-pushes-a-button","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/","title":{"rendered":"Typing Enter Pushes a Button"},"content":{"rendered":"<p>As a beginner developer of PowerShell GUIs, I&#8217;m always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing &lt;Enter&gt; in a textbox to invoke a function instead of clicking a Start, Go, or OK button.<\/p>\n<p>In this post, I&#8217;ll show you two ways to do it. One technique is significantly simpler than the other, but works only when there is exactly one &#8220;Go&#8221; button. The more complex technique works for multiple buttons and keys other than &lt;Enter&gt;.<\/p>\n<h3>Registering a KeyDown Event Handler<\/h3>\n<p>Let&#8217;s start with the general, more complex technique. We&#8217;ll create a KeyDown event handler for the &lt;Enter&gt; key, but you can use the same method to register an event handler for any key. Our event handler will click a particular button, but you can set it up to click any button on the user&#8217;s behalf.<\/p>\n<p>Here&#8217;s the typical situation. In this little app, when you type a valid value in the textbox, the <b>Get-Service<\/b> button is enabled. You can click the Get-Service button, but it would be nice to let the user just type &lt;Enter&gt; after typing the computer name.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/GetServicePsf.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-9633\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/GetServicePsf-300x89.png\" alt=\"GetServicePsf\" width=\"300\" height=\"89\" srcset=\"https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/GetServicePsf-300x89.png 300w, https:\/\/dev.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/GetServicePsf.png 559w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>To enable the &#8220;press &lt;Enter&gt;&#8221; feature, use the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.forms.control.keydown(v=vs.110).aspx\" target=\"_blank\"><b>KeyDown<\/b> event<\/a> of the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.forms.textbox(v=vs.110).aspx\" target=\"_blank\">Textbox object<\/a> (System.Windows.Forms.Textbox):<\/p>\n<p>1. Start by creating a variable to hold the <b>KeyDown<\/b> event of the textbox. Following the best practice naming guidelines, I&#8217;ll name the variable <b>$textboxComputerName_KeyDown<\/b>.<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName_KeyDown = {}<\/pre>\n<p>2. The <b>KeyDown<\/b> event handler requires a <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.forms.keyeventhandler(v=vs.110).aspx\"><b>KeyEventHandler<\/b> object<\/a>, so we&#8217;ll cast the script block as a <b>KeyEventHandler<\/b> object.<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName_KeyDown = [System.Windows.Forms.KeyEventHandler]{}<\/pre>\n<p>3. When the <strong>KeyCode<\/strong> property value ($_.KeyCode) is &#8220;Enter&#8221;, we want to click the Get-Service button on the user&#8217;s behalf. To click the button, call the Invoke() method of the Click event of the button ($buttonGetService.Click). Referencing the Click event without calling the Invoke() method has no effect.<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName_KeyDown = [System.Windows.Forms.KeyEventHandler]{\r\n    if ($_.KeyCode -eq 'Enter')\r\n    {\r\n        $buttonGetServices_Click.Invoke()\r\n    }\r\n}<\/pre>\n<p>Or, you can use the PerformClick() method of the button. This makes your intent much clearer than just invoking an event handler function. (Many thanks to Charlie Eberly for this suggestion!)<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName_KeyDown = [System.Windows.Forms.KeyEventHandler]{\r\n    if ($_.KeyCode -eq 'Enter')\r\n    {\r\n        $buttonGetServices.PerformClick()\r\n    }\r\n}<\/pre>\n<p>4. Set the <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/system.windows.forms.keyeventargs.suppresskeypress(v=vs.110).aspx\"><b>SuppressKeyPress<\/b> property<\/a> of the <strong>KeyEventArgs<\/strong> object to $True.<\/p>\n<p>When you invoke the <b>Click<\/b> event of the button on the user&#8217;s behalf, you want to prevent the user from clicking the button, too. Otherwise, the button could be clicked multiple times. Also, the Click generates a sound that&#8217;s typically associated with clicking a button, but not with pressing &lt;Enter&gt;. Setting <strong>SuppressKeyPress<\/strong> to $True takes care of this for you.<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName_KeyDown = [System.Windows.Forms.KeyEventHandler]{\r\n\r\n    if ($_.KeyCode -eq 'Enter')\r\n    {\r\n        $buttonGetServices_Click.Invoke()\r\n\r\n        #Suppress sound from unexpected use of enter on keyPress\/keyUp\r\n        $_.SuppressKeyPress = $true\r\n    }\r\n}<\/pre>\n<p>The KeyDown event handler is now complete.<\/p>\n<p>The final step is to register the <strong>KeyDown<\/strong> event handler, that is, to associate the event hander with the <strong>KeyDown<\/strong> event so that when the <strong>KeyDown<\/strong> event happens (&#8220;is raised&#8221;), the system runs the event handler code. Because <strong>KeyDown<\/strong> is not the default event of a Textbox object, <i>PowerShell Studio<\/i> doesn&#8217;t do it for you, but it&#8217;s very easy to do.<\/p>\n<p><b>To register the event handler in PowerShell Studio:<\/b><\/p>\n<p>1. In <i>PowerShell Studio<\/i>, in the Designer window, click the textbox.<\/p>\n<p>2. In the Properties pane for the textbox, on the row for the <b>KeyDown<\/b> event, type the name of the event handler.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image004.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"clip_image004\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image004_thumb.jpg\" alt=\"clip_image004\" width=\"202\" height=\"244\" border=\"0\" \/><\/a><\/p>\n<p><b>To register the event manually <\/b>(without <i>PowerShell Studio<\/i>)<b>:<\/b><\/p>\n<p>1. Write a statement that registers the event handler.<\/p>\n<p>The syntax is:<\/p>\n<pre lang=\"PowerShell\"><FormControl>.add<EventName>()<\/pre>\n<p>For example:<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName.add_KeyDown($textboxComputerName_KeyDown)<\/pre>\n<p>2. Remember to remove the event handler in your cleanup step.<\/p>\n<p>For example:<\/p>\n<pre lang=\"PowerShell\">$textboxComputerName.remove_KeyDown($textboxComputerName_KeyDown)<\/pre>\n<h3>Set the Accept Button of the Form<\/h3>\n<p>Writing a KeyDown event is conceptually a bit complex, but it&#8217;s not difficult to do. However, the other technique is so simple that you&#8217;ll use it whenever you can.<\/p>\n<p>Every form has an <b>AcceptButton<\/b> property that is invoked automatically when the user types &lt;Enter&gt;. Typically, the <strong>AcceptButton<\/strong> property is set to the OK button, if there is one, but you can set it to any button on the form (or not set it).<\/p>\n<p>NOTE: In PowerShell Studio, when you use a form template that includes an OK button, such as a Dialog Style form, the AcceptButton is set to the OK button by default.<\/p>\n<p>In the <i>PowerShell Studio<\/i> designer and in the running application, the <b>AcceptButton<\/b> is indicated by a blue border.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image006.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"margin: 0px; display: inline; background-image: none;\" title=\"clip_image006\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image006_thumb.jpg\" alt=\"clip_image006\" width=\"244\" height=\"67\" border=\"0\" \/><\/a><\/p>\n<p><b>To set the AcceptButton property of the form:<\/b><br \/>\n&#8212; In the Properties box for the form, in the row for the AcceptButton property, use the drop-down menu to select a button.<\/p>\n<p><a href=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image007.png\"><img loading=\"lazy\" decoding=\"async\" style=\"display: inline; background-image: none;\" title=\"clip_image007\" src=\"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/clip_image007_thumb.png\" alt=\"clip_image007\" width=\"173\" height=\"244\" border=\"0\" \/><\/a><\/p>\n<p>-or-<\/p>\n<p>&#8212; In the Load event of the form, set the <b>AcceptButton<\/b> property of the form to the desired button.<\/p>\n<pre lang=\"PowerShell\">$formGetService_Load = {\r\n    $formGetService.AcceptButton = $buttonGetService\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<p>Now that you know both techniques, remember not to use them together. If the <strong>AcceptButton<\/strong> property of the form is set to <em>any<\/em> button, that property value takes precedence over a <strong>KeyDown<\/strong> event with an &#8216;Enter&#8217; key code. For example, if you write a <strong>KeyDown<\/strong> event for\u00a0$buttonGetServices\u00a0and set the <strong>AcceptButton<\/strong> property of the form\u00a0is $buttonOK, when you click enter in the textbox, it clicks $buttonOK.<\/p>\n<p>Allowing the user to press &lt;Enter&gt; in your app, instead of forcing them to click a button, improves the usability of your app. Spend an extra few minutes setting the <b>AcceptButton<\/b> property, or even registering a <b>KeyDown<\/b> event.<\/p>\n<p><i>June Blender is a technology evangelist at SAPIEN Technologies, Inc and a Windows PowerShell MVP. You can reach her at <a href=\"mailto:juneb@sapien.com\" target=\"_blank\">juneb@sapien.com<\/a> and follow her on Twitter at <a href=\"http:\/\/twitter.com\/juneb_get_help\" target=\"_blank\">@juneb_get_help<\/a>.<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a beginner developer of PowerShell GUIs, I&#8217;m always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing &lt;Enter&gt; in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I&#8217;ll show [&hellip;]<\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[932,946,703,25],"tags":[135,934,988,1016],"class_list":["post-9631","post","type-post","status-publish","format-standard","hentry","category-beginners","category-guiprogramming","category-powershell-studio","category-windows-powershell","tag-beginner","tag-juneb","tag-powershell-gui","tag-powershell-studio"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"As a beginner developer of PowerShell GUIs, I&#039;m always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I&#039;ll show\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"June Blender\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Typing Enter Pushes a Button - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"As a beginner developer of PowerShell GUIs, I&#039;m always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I&#039;ll show\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2015-08-17T13:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2015-09-17T16:41:35+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Typing Enter Pushes a Button - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"As a beginner developer of PowerShell GUIs, I&#039;m always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I&#039;ll show\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#blogposting\",\"name\":\"Typing Enter Pushes a Button - DEV SAPIEN Blog\",\"headline\":\"Typing Enter Pushes a Button\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/www.sapien.com\\\/blog\\\/wp-content\\\/uploads\\\/2015\\\/08\\\/GetServicePsf-300x89.png\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#articleImage\"},\"datePublished\":\"2015-08-17T06:00:00-07:00\",\"dateModified\":\"2015-09-17T09:41:35-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":20,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#webpage\"},\"articleSection\":\"Beginners, GUIProgramming, PowerShell Studio, Windows PowerShell, beginner, juneb, PowerShell GUI, PowerShell Studio\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"name\":\"Software News\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"position\":2,\"name\":\"Software News\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/powershell-studio\\\/#listItem\",\"name\":\"PowerShell Studio\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/powershell-studio\\\/#listItem\",\"position\":3,\"name\":\"PowerShell Studio\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/powershell-studio\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#listItem\",\"name\":\"Typing Enter Pushes a Button\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/#listItem\",\"name\":\"Software News\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#listItem\",\"position\":4,\"name\":\"Typing Enter Pushes a Button\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/software-news\\\/powershell-studio\\\/#listItem\",\"name\":\"PowerShell Studio\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/\",\"name\":\"June Blender\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/\",\"name\":\"Typing Enter Pushes a Button - DEV SAPIEN Blog\",\"description\":\"As a beginner developer of PowerShell GUIs, I'm always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I'll show\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2015\\\/08\\\/17\\\/typing-enter-pushes-a-button\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/juneblender\\\/#author\"},\"datePublished\":\"2015-08-17T06:00:00-07:00\",\"dateModified\":\"2015-09-17T09:41:35-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Typing Enter Pushes a Button - DEV SAPIEN Blog","description":"As a beginner developer of PowerShell GUIs, I'm always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I'll show","canonical_url":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#blogposting","name":"Typing Enter Pushes a Button - DEV SAPIEN Blog","headline":"Typing Enter Pushes a Button","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2015\/08\/GetServicePsf-300x89.png","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#articleImage"},"datePublished":"2015-08-17T06:00:00-07:00","dateModified":"2015-09-17T09:41:35-07:00","inLanguage":"en-US","commentCount":20,"mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#webpage"},"articleSection":"Beginners, GUIProgramming, PowerShell Studio, Windows PowerShell, beginner, juneb, PowerShell GUI, PowerShell Studio"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","name":"Software News"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","position":2,"name":"Software News","item":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/#listItem","name":"PowerShell Studio"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/#listItem","position":3,"name":"PowerShell Studio","item":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#listItem","name":"Typing Enter Pushes a Button"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/#listItem","name":"Software News"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#listItem","position":4,"name":"Typing Enter Pushes a Button","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/#listItem","name":"PowerShell Studio"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/","name":"June Blender"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/","name":"Typing Enter Pushes a Button - DEV SAPIEN Blog","description":"As a beginner developer of PowerShell GUIs, I'm always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I'll show","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/juneblender\/#author"},"datePublished":"2015-08-17T06:00:00-07:00","dateModified":"2015-09-17T09:41:35-07:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"Typing Enter Pushes a Button - DEV SAPIEN Blog","og:description":"As a beginner developer of PowerShell GUIs, I'm always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I'll show","og:url":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/","article:published_time":"2015-08-17T13:00:00+00:00","article:modified_time":"2015-09-17T16:41:35+00:00","twitter:card":"summary_large_image","twitter:title":"Typing Enter Pushes a Button - DEV SAPIEN Blog","twitter:description":"As a beginner developer of PowerShell GUIs, I'm always looking for easy ways to make my simple applications more sophisticated and usable. One of the basic usability features in most applications is typing in a textbox to invoke a function instead of clicking a Start, Go, or OK button. In this post, I'll show"},"aioseo_meta_data":{"post_id":"9631","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 15:56:25","updated":"2026-08-28 15:56:25"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/\" title=\"Software News\">Software News<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/\" title=\"PowerShell Studio\">PowerShell Studio<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tTyping Enter Pushes a Button\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"Software News","link":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/"},{"label":"PowerShell Studio","link":"https:\/\/dev.sapien.com\/blog\/topics\/software-news\/powershell-studio\/"},{"label":"Typing Enter Pushes a Button","link":"https:\/\/dev.sapien.com\/blog\/2015\/08\/17\/typing-enter-pushes-a-button\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=9631"}],"version-history":[{"count":41,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9631\/revisions"}],"predecessor-version":[{"id":9893,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/9631\/revisions\/9893"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=9631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=9631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=9631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}