Manually setting column sorting colors and current sort column

In Clarion 9 or 9.1 support was added control the color of the header and column of the list that is the current sorted column.
Here is a very simple example demonstrating how to manually set the sort column prior to the user clicking on any of the list box’s column headers.

  PROGRAM

OMIT('***')
 * Created with Clarion 11.0
 * User: Rick
 * Date: 1/20/2020
 * Time: 3:17 PM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 ***

                              MAP
                              END
LIST1:Queue                   queue
Field1                          string(20)
Field2                          string(20)
Field3                          string(20)
                              end

TestWindow                    WINDOW('Test Sort Column Color'),AT(,,315,184),GRAY,FONT('Segoe UI',12), |
                                  DOUBLE
                                LIST,AT(43,16,220,142),USE(?LIST1),FROM(LIST1:Queue),FORMAT('36L(2)|M~Field1' & |
                                    '~@S20@58L(2)|M~Field2~@S20@20L(2)|M~Field3~@S20@')
                              END

  CODE
  do loadqueue
  open(TestWindow)
  ?LIST1{PROPLIST:HasSortColumn} = 1
  ?LIST1{PROPLIST:SortColumn} = 2
  ?LIST1{PROPLIST:HdrSortBackColor} = COLOR:Aqua
  ?LIST1{PROPLIST:HdrSortTextColor} = COLOR:White
  ?LIST1{PROPLIST:SortBackColor} = COLOR:Aqua
  ?LIST1{PROPLIST:SortTextColor} = COLOR:White
  accept
  end
  close(TestWindow)
  
loadqueue                     routine
  LIST1:Queue.Field1 = 'row 1 field 1'
  LIST1:Queue.Field2 = 'row 1 field 2'
  LIST1:Queue.Field3 = 'row 1 field 3'
  add(LIST1:Queue)
  LIST1:Queue.Field1 = 'row 2 field 1'
  LIST1:Queue.Field2 = 'row 2 field 2'
  LIST1:Queue.Field3 = 'row 2 field 3'
  add(LIST1:Queue)
  LIST1:Queue.Field1 = 'row 3 field 1'
  LIST1:Queue.Field2 = 'row 3 field 2'
  LIST1:Queue.Field3 = 'row 3 field 3'
  add(LIST1:Queue)
2 Likes