I'm using a report view with headers and I've used some code I found in the database for sorting the columns when the header is clicked. It's working fine except the part that re-names the header. It updates the 1st columns to be ASCENDING or DESCENDING as appropriate. However, if this isnt appropriate if the user clicks the second or third column. How can I tell which header the user clicks on so I can update the appropriate column?
Thanks
if you capture the MSG_RVHEADER event, the column header name that was clicked on is in the fifth callback parameter. Or as the help file puts it:
QuoteColumn Click: User has used the mouse to click a column header of a REPORTVIEW control. The one based column number of the clicked column is passed to the callback UDF/UDS in the callback's fifth parameter. The event is fired before the indicated column is sorted so the sort direction can be controlled by setting or changing the sort direction style of the control during the callback. Sorting is effectively cancelled by removing both sorting related styles from the control.
-Kirby
In your MSG_RVHEADER (22) event, you can look at the fifth parameter of your dialog callback function (MyDialog_ChangeInfo) to see what number is the column that was selected.
case MSG_RVHEADER
selectedCol = MyDialog_ChangeInfo
Pause('Selected Column Number',selectedCol)
return(RET_DO_NOT_EXIT)