Sorting the Items in a Choice List

You can sort the items in a choice list by alphabetical order. You can do this any time after the memory file is created. If the choice list is on the screen when you sort the choice list items, you must redisplay the choice list with cl_upd().

Sorting also causes the menu items to be renumbered to correspond to their new positions in the choice list. For sorting, the current item number remains the same; thus, the highlighted item may change after the sort.

Sorting of choice lists is accomplished by using the memory file sort routine, mf_sort():

int mf_sort(kwdp, mfp)
 
UCHAR *kwdp;
/* Keyword for choice list
*/
MFILEPTR mfp;
/* Memory file containing choice list
*/

By specifying the keyword, you can sort only that keyword section of the memory file. If your entire memory is filled with keyworded sections and you want to sort each section individually, specify NULLP for kwdp.

Caution: In order for a memory file to be sorted within each keyword, the first character on the first row and first column of the memory file must be the keyword character. Also, special restrictions apply when sorting a choice list that is built in code rather than read from a disk file, and when sorting a choice list that uses automatic keyword loading. See Chapter 45, "Creating and Viewing Memory Files," for complete information.


Home Contents Previous Next