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) ) )
aListName.SortWith( aListFile )
For i As Integer = 0 to aListName.Ubound
myPopup.Addrow( aListName(i) )
myPopup.RowTag( myPopup.ListCount - 1 ) = aListFile(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.
If you want to make the most of the software that you have acquired at Maxprog, do not miss the Stan's Blog. It is a library of Tutorials and Tips covering specific features and tipical problems you may have when using our tools. This page is updated regularly depending on the topics discussed in our public forums and issues reported thru our HelpDesk. If you are interested on what we are currently working on (or want to participate in beta testings) don't miss the Stan's Logbook.
For years, MAX Programming has provided companies around the globe with sophisticated and innovative solutions. Our commitment to quality is not only evident in our products, but also in our people. It is our mission in Professional Support Services to ensure that our products perform to the fullest of their ability in order to meet the business objectives of our customers. We provide the tools and information required for improved productivity. To accomplish this, we offer an array of services including: Technical Support, Education Services and Consulting Services.