(no subject)

Shao Sean shaosean at wehostmacs.com
Sat May 2 23:05:07 EDT 2009


modified it some to be a little cleaner as well as allowing the data  
grid to know that it is sorting on the custom sorted column..


command sortDataGridColumn pColumn
   constant kColumnSize = "size"
   local tOldSortKey
   lock screen

   switch (pColumn)
     case kColumnSize
       lock messages
       put the dgProps["sort by column"] of me into tOldSortKey
       set the dgProps["sort by column"] of me to kColumnSize

       if (the dgColumnSortDirection[kColumnSize] of me =  
"ascending") then
         set the dgColumnSortDirection[kColumnSize] of me to  
"descending"
       else
         set the dgColumnSortDirection[kColumnSize] of me to "ascending"
       end if
       unlock messages

       sortDataByKey kColumnSize, "numeric", the dgColumnSortDirection 
[kColumnSize] of me, FALSE

       set the dgHilite of group tOldSortKey of group "dgHeader" to  
FALSE
       set the dgHilite of group kColumnSize of group "dgHeader" to TRUE
       break
     default
       pass sortDataGridColumn
       break
   end switch
end sortDataGridColumn



More information about the use-livecode mailing list