{"id":674,"date":"2015-04-09T15:51:04","date_gmt":"2015-04-09T22:51:04","guid":{"rendered":"http:\/\/appinventor.pevest.com\/?p=674"},"modified":"2015-04-09T15:51:04","modified_gmt":"2015-04-09T22:51:04","slug":"multiline-text-input-in-app-inventor","status":"publish","type":"post","link":"https:\/\/coldstreams.com\/appinventor\/2015\/04\/09\/multiline-text-input-in-app-inventor\/","title":{"rendered":"Multiline text input in App Inventor"},"content":{"rendered":"<p>The App Inventor <em>TextBox<\/em>\u00a0control supports both single line and multi-line input; the <em><span style=\"text-decoration: underline;\">TextBox<\/span><\/em> control default to single line mode &#8211; and you may not have realized it can support multiple line text input too!<\/p>\n<p>In single line input, text is entered using the on screen keyboard, followed by the Enter key (or you can use an external Bluetooth keyboard). Once the enter key is pressed, the on screen keyboard goes away.<\/p>\n<p>Multi-line mode is enabled by checking the <em>Multiline<\/em> checkbox item in the control properties. However, the Enter key is used to enter multiple text lines &#8211; that means you need to complete the multiline text entry by adding another control, such as a Done button.<\/p>\n<p>The multi-line control is easy to use &#8211; and needs just a single line of blocks code to implement! Describing the operation of the control takes more time!<\/p>\n<h2>App View<\/h2>\n<p>The multiline <em>TextBox<\/em> looks like a single line text box, as shown here, after entering &#8220;first line&#8221; into the <em>TextBox<\/em> control as the app is running.<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Screenshot_2015-04-08-18-03-40.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  aligncenter wp-image-677\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Screenshot_2015-04-08-18-03-40-576x1024.png\" alt=\"Screenshot_2015-04-08-18-03-40\" width=\"350\" height=\"622\" \/><\/a><\/p>\n<p>To enter a second (or third&#8230;) line, tap the green\/blue Enter button at the lower right of the onscreen keyboard. Here is the result after typing three lines of text:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Screenshot_2015-04-08-18-03-57.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  aligncenter wp-image-678\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Screenshot_2015-04-08-18-03-57-576x1024.png\" alt=\"Screenshot_2015-04-08-18-03-57\" width=\"350\" height=\"622\" \/><\/a><\/p>\n<p><!--more--><\/p>\n<h2>The Designer View<\/h2>\n<p>To set up a multiline <em>TextBox<\/em>, drag the <em>TextBox<\/em> control from the palette to the Canvas. Add a <em>Button<\/em> control and change the text on the button to say &#8220;Done:.<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineDesigner.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-675 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineDesigner.png\" alt=\"MultilineDesigner\" width=\"323\" height=\"153\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>Click the mouse (or select) the TextBox control and then refer to the control&#8217;s properties on the right side of the Designer view. In the Properties list, scan down to the <em>MultiLine<\/em> item and check the checkbox.<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineProperties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-676 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineProperties.png\" alt=\"MultilineProperties\" width=\"157\" height=\"525\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Blocks View<\/h2>\n<p>After all that description, how do we implement this feature? With one block to hide the keyboard after data entry!<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineBlocks.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-679 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/MultilineBlocks.png\" alt=\"MultilineBlocks\" width=\"406\" height=\"98\" \/><\/a><\/p>\n<p>The trick for the multiline input box is to set the multiline property to true, and then add another control to indicate when data entry is finished. Here, we use a <em>Button<\/em> and handle the click event by calling the <em>HideKeyboard<\/em> method of <em>TextBox1<\/em>.<\/p>\n<p>To obtain the entered text, refer to the <em>Text<\/em> property of <em>TextBox1<\/em>:<\/p>\n<p><a href=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Mutliline-text.png\"><img loading=\"lazy\" decoding=\"async\" class=\"  wp-image-680 aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2015\/04\/Mutliline-text.png\" alt=\"Mutliline-text\" width=\"219\" height=\"46\" \/><\/a><\/p>\n<p>Easy, huh?<\/p>\n<p><strong>Please Share on Social Media<\/strong><\/p>\n<p>Please click on the buttons below this post to share with your friends on Facebook or other social media.<\/p>\n<p>If you are not already following this blog, click on the following links to like on Facebook, add to your Google+ circles or follow on Twitter or in your RSS news reader. Thank you for visiting!<\/p>\n<p><a href=\"https:\/\/www.facebook.com\/appinventor2\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/appinventor.pevest.com\/wp-content\/uploads\/2014\/10\/facebook-like.png\" alt=\"\" width=\"150\" \/><\/a><a href=\"https:\/\/plus.google.com\/107302082825289724871\/posts\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/coldstreams.com\/images\/plus-badge.png\" alt=\"\" width=\"48\" \/><\/a><a href=\"http:\/\/twitter.com\/appinventorplus\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/coldstreams.com\/images\/twitter-follow.png\" alt=\"\" width=\"100\" \/><\/a><a href=\"http:\/\/appinventor.pevest.com\/?feed=rss2\"><img decoding=\"async\" class=\"aligncenter\" src=\"http:\/\/coldstreams.com\/images\/rss.png\" alt=\"\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The App Inventor TextBox\u00a0control supports both single line and multi-line input; the TextBox control default to single line mode &#8211; and you may not have realized it can support multiple line text input too! In single line input, text is entered using the on screen keyboard, followed by the Enter key (or you can use &hellip; <a href=\"https:\/\/coldstreams.com\/appinventor\/2015\/04\/09\/multiline-text-input-in-app-inventor\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Multiline text input in App Inventor<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-674","post","type-post","status-publish","format-standard","hentry","category-components"],"_links":{"self":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/674","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/comments?post=674"}],"version-history":[{"count":0,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/posts\/674\/revisions"}],"wp:attachment":[{"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/media?parent=674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/categories?post=674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coldstreams.com\/appinventor\/wp-json\/wp\/v2\/tags?post=674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}