Support

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

Topics

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
at www.maxprog.com






Stan Busk Stan Busk
October 29, 2017






Recent questions from our users
  Mail rejected as SPAM UPDATED Screenshot
  How do I enter turboSMTP settings into MaxBulk Mailer YouTube Video
  How I can change the old activation key with the new one? YouTube Video
  Why do I get a Delivery Report message after each delivery? YouTube Video
  Setting DKIM on MaxBulk Mailer YouTube Video
  How do I add an Unsubscribe link to my messages
  How to import a Bank statement into iCash YouTube Video
  Is Maxprog software prepared for macOS 11 Big Sur? Screenshot
  How to transfer email lists between MaxBulk Mailer copies Screenshot
  How can I download files with sequential numbers in their name? YouTube Video
  Images are missing in the message preview Screenshot
  How to send an email with a picture in the body YouTube Video
  How can I send to a big list of emails with MaxBulk Mailer YouTube Video
  Mail-merge sender data using tags YouTube Video
  I set up my bulk email message but authentication fails YouTube Video

  [Valid RSS]  Subscribe to Maxprog's Knowledge Base

▾ Last videos, Online events and Q&A Sessions ▾

▾ Last customer reviews ▾


Did you like this post?


🔐 Site secured by Comodo SSL
🟢 UptimeRobot - Site Loaded properly