Home Products Downloads News Store Support

Stan's Blog

Sorting a Popup menu with RowTags

How to use Maxprog products Maxprog's Blog

Compatible with MS Windows Compatible with MacOS

Sorting a Popup menu with RowTags


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 'f' is the folder we want to display the items of, this is the code:

Dim aData, aListName(), aListFile() As String

For i As Integer = 1 to f.count()
  f = f.Child( f.item(i).Name )
  aListName.Append( f.item(i).Name )
  aListFile.Append( f.item(i).GetSaveInfo( Volume(0) ) )
next i

aListName.SortWith( aListFile )
For i As Integer = 0 to aListName.Ubound
  myPopup.Addrow( aListName(i) )
  myPopup.RowTag( myPopup.ListCount - 1 ) = aListFile(i)
Next i

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.

There are more examples here.

Stan Busk - Software Engineer


Recent questions from our users
  How to create new projects in iCash NEW Screenshot
  How to add transactions to iCash faster NEW YouTube Video
  What is the best mail server I can use with MaxBulk Mailer Screenshot
  How can I export my lists to a new computer Screenshot
  How to send a HTML email Screenshot
  How to hide text in my message Screenshot
  How to transfer FTP accounts between computers Screenshot
  Google ending support for less secure apps YouTube Video
  How to add social networks icons to my message Screenshot
  How do I set up an unsubscribe link Screenshot
  How to export several lists into to a single file Screenshot
  Why do I get timeouts when testing given addresses Screenshot
  What are the Zoho mail settings for MaxBulk Mailer? Screenshot
  iCash has become slow over time Screenshot
  Emails sent but not received Screenshot

▾ Last videos, Online events and Q&A Sessions ▾
 !  IMPORTANT NOTICE: Our office will be closed for holidays from December 15th, 2023 until December 26th, 2023 inclusive, our support may be limited so please expect a delayed response during that period. More information here. Thank you for your patience and understanding.
▾ Last customer reviews ▾

Did you like this post?

🔐 Secured by Comodo SSL | UptimeRobot - Site Loaded properly