{"id":787,"date":"2017-10-29T05:23:57","date_gmt":"2017-10-29T10:23:57","guid":{"rendered":"https:\/\/www.maxprog.com\/blog\/?p=787"},"modified":"2017-10-29T05:40:03","modified_gmt":"2017-10-29T10:40:03","slug":"sorting-a-popup-menu-with-rowtags","status":"publish","type":"post","link":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/","title":{"rendered":"Sorting a Popup menu with RowTags"},"content":{"rendered":"<p>Imagine you want to load a popup menu with the name of the files from a given folder, the user will later select an entry from that popup menu to load that file thanks to the file info we will store in the popup menu rowtag property. Now what if we want <a href=\"https:\/\/forum.xojo.com\/22842-sorting-a-popupmenu\/0\" rel=\"noopener\" target=\"_blank\">to sort the popup menu alphabetically<\/a>?<\/p>\n<p>The solution is to load the data into a couple of arrays, sort those arrays together and then load the result into the popup menu. Given &#8216;f&#8217; is the folder we want to display the items of, this is the code:<br \/>\n<code><br \/>\nDim aData, aListName(), aListFile() As String<\/p>\n<p>For i As Integer = 1 to f.count()<br \/>\n\u00a0\u00a0f = f.Child( f.item(i).Name )<br \/>\n\u00a0\u00a0aListName.Append( f.item(i).Name )<br \/>\n\u00a0\u00a0aListFile.Append( f.item(i).GetSaveInfo( Volume(0) ) )<br \/>\nnext i<\/p>\n<p>aListName.SortWith( aListFile )<br \/>\nFor i As Integer = 0 to aListName.Ubound<br \/>\n\u00a0\u00a0myPopup.Addrow( aListName(i) )<br \/>\n\u00a0\u00a0myPopup.RowTag( myPopup.ListCount - 1 ) = aListFile(i)<br \/>\nNext i<\/code><\/p>\n<p>We create two arrays, load them with the folder items data, sort both arrays together by file name and load the popup menu with the result. If you run the code you will see the popup menu displays all the file names properly sorted alphabetically and rowtag contain the right file info.<\/p>\n<p>There are more examples <a href=\"http:\/\/developer.xojo.com\/arrays$SortWith\" rel=\"noopener\" target=\"_blank\">here<\/a>.<\/p>\n<p>\u2014<br \/>\nStan Busk &#8211; Software Engineer<br \/>\nat <a href=\"https:\/\/www.maxprog.com\" target=\"_blank\">www.maxprog.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Imagine you want to load a popup menu with the name of the files from a given folder, the user will later select an entry from that popup menu to load that file thanks to the file info we will store in the popup menu rowtag property. Now what if we want to sort the popup menu alphabetically? The solution is to load the data into a couple of arrays, sort those arrays together and then load the result into the popup menu. Given &#8216;f&#8217; is the folder we want to display the items of, this is the code: Dim &hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[57,56],"class_list":["post-787","post","type-post","status-publish","format-standard","hentry","category-xojo","tag-popup-menu","tag-xojo"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Sorting a Popup menu with RowTags - Tips and tricks<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sorting a Popup menu with RowTags\" \/>\n<meta property=\"og:description\" content=\"Imagine you want to load a popup menu with the name of the files from a given folder, the user will later select an entry from that popup menu to load that file thanks to the file info we will store in the popup menu rowtag property. Now what if we want to sort the popup menu alphabetically? The solution is to load the data into a couple of arrays, sort those arrays together and then load the result into the popup menu. Given &#8216;f&#8217; is the folder we want to display the items of, this is the code: Dim &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/\" \/>\n<meta property=\"og:site_name\" content=\"Tips and tricks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/maxprog\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/maxprog\" \/>\n<meta property=\"article:published_time\" content=\"2017-10-29T10:23:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-10-29T10:40:03+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@maxprog\" \/>\n<meta name=\"twitter:site\" content=\"@maxprog\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/person\\\/94903012a832903f334e8b939c2ac916\"},\"headline\":\"Sorting a Popup menu with RowTags\",\"datePublished\":\"2017-10-29T10:23:57+00:00\",\"dateModified\":\"2017-10-29T10:40:03+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/\"},\"wordCount\":171,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\"},\"keywords\":[\"popup menu\",\"Xojo\"],\"articleSection\":[\"Xojo\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/\",\"name\":\"Sorting a Popup menu with RowTags - Tips and tricks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#website\"},\"datePublished\":\"2017-10-29T10:23:57+00:00\",\"dateModified\":\"2017-10-29T10:40:03+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/sorting-a-popup-menu-with-rowtags\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sorting a Popup menu with RowTags\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\",\"name\":\"Tips and tricks\",\"description\":\"How to use Maxprog products\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#organization\",\"name\":\"Maxprog\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/logo_maxprog_pict_white_with_blue_back_512x512.png\",\"contentUrl\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/04\\\/logo_maxprog_pict_white_with_blue_back_512x512.png\",\"width\":512,\"height\":512,\"caption\":\"Maxprog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/maxprog\",\"https:\\\/\\\/x.com\\\/maxprog\",\"https:\\\/\\\/www.instagram.com\\\/stanbusk\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/maxprog\",\"https:\\\/\\\/es.pinterest.com\\\/stanbusk\\\/\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Maxprog\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.maxprog.com\\\/blog\\\/#\\\/schema\\\/person\\\/94903012a832903f334e8b939c2ac916\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"description\":\"Software engineer at maxprog.com\",\"sameAs\":[\"https:\\\/\\\/www.maxprog.com\\\/\",\"https:\\\/\\\/www.facebook.com\\\/maxprog\",\"https:\\\/\\\/www.instagram.com\\\/maxprog8\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/maxprog\",\"https:\\\/\\\/www.pinterest.es\\\/stanbusk\",\"https:\\\/\\\/x.com\\\/maxprog\",\"https:\\\/\\\/www.youtube.com\\\/c\\\/Maxprog\",\"https:\\\/\\\/maxprog.tumblr.com\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Sorting a Popup menu with RowTags - Tips and tricks","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/","og_locale":"en_US","og_type":"article","og_title":"Sorting a Popup menu with RowTags","og_description":"Imagine you want to load a popup menu with the name of the files from a given folder, the user will later select an entry from that popup menu to load that file thanks to the file info we will store in the popup menu rowtag property. Now what if we want to sort the popup menu alphabetically? The solution is to load the data into a couple of arrays, sort those arrays together and then load the result into the popup menu. Given &#8216;f&#8217; is the folder we want to display the items of, this is the code: Dim &hellip;","og_url":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/","og_site_name":"Tips and tricks","article_publisher":"https:\/\/www.facebook.com\/maxprog","article_author":"https:\/\/www.facebook.com\/maxprog","article_published_time":"2017-10-29T10:23:57+00:00","article_modified_time":"2017-10-29T10:40:03+00:00","author":"admin","twitter_card":"summary_large_image","twitter_creator":"@maxprog","twitter_site":"@maxprog","twitter_misc":{"Written by":"admin","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/#article","isPartOf":{"@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/"},"author":{"name":"admin","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/person\/94903012a832903f334e8b939c2ac916"},"headline":"Sorting a Popup menu with RowTags","datePublished":"2017-10-29T10:23:57+00:00","dateModified":"2017-10-29T10:40:03+00:00","mainEntityOfPage":{"@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/"},"wordCount":171,"commentCount":0,"publisher":{"@id":"https:\/\/www.maxprog.com\/blog\/#organization"},"keywords":["popup menu","Xojo"],"articleSection":["Xojo"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/","url":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/","name":"Sorting a Popup menu with RowTags - Tips and tricks","isPartOf":{"@id":"https:\/\/www.maxprog.com\/blog\/#website"},"datePublished":"2017-10-29T10:23:57+00:00","dateModified":"2017-10-29T10:40:03+00:00","breadcrumb":{"@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.maxprog.com\/blog\/sorting-a-popup-menu-with-rowtags\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.maxprog.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Sorting a Popup menu with RowTags"}]},{"@type":"WebSite","@id":"https:\/\/www.maxprog.com\/blog\/#website","url":"https:\/\/www.maxprog.com\/blog\/","name":"Tips and tricks","description":"How to use Maxprog products","publisher":{"@id":"https:\/\/www.maxprog.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.maxprog.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.maxprog.com\/blog\/#organization","name":"Maxprog","url":"https:\/\/www.maxprog.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.maxprog.com\/blog\/wp-content\/uploads\/2019\/04\/logo_maxprog_pict_white_with_blue_back_512x512.png","contentUrl":"https:\/\/www.maxprog.com\/blog\/wp-content\/uploads\/2019\/04\/logo_maxprog_pict_white_with_blue_back_512x512.png","width":512,"height":512,"caption":"Maxprog"},"image":{"@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/maxprog","https:\/\/x.com\/maxprog","https:\/\/www.instagram.com\/stanbusk\/","https:\/\/www.linkedin.com\/company\/maxprog","https:\/\/es.pinterest.com\/stanbusk\/","https:\/\/www.youtube.com\/c\/Maxprog"]},{"@type":"Person","@id":"https:\/\/www.maxprog.com\/blog\/#\/schema\/person\/94903012a832903f334e8b939c2ac916","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/49daac01857e4ec6646801107e47c7f62856c94d4ef7caf1a296f296c790fb81?s=96&d=mm&r=g","caption":"admin"},"description":"Software engineer at maxprog.com","sameAs":["https:\/\/www.maxprog.com\/","https:\/\/www.facebook.com\/maxprog","https:\/\/www.instagram.com\/maxprog8\/","https:\/\/www.linkedin.com\/company\/maxprog","https:\/\/www.pinterest.es\/stanbusk","https:\/\/x.com\/maxprog","https:\/\/www.youtube.com\/c\/Maxprog","https:\/\/maxprog.tumblr.com"]}]}},"_links":{"self":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts\/787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/comments?post=787"}],"version-history":[{"count":0,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/posts\/787\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/media?parent=787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/categories?post=787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maxprog.com\/blog\/wp-json\/wp\/v2\/tags?post=787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}