General information
Category:
Forms & Form designer
>I was envisaging this as letting the user to (to get the Company + Department + Surname order) click on the Company column header, which will then sort the grid by Company, then they can Ctrl+Click on the Department header which will set the order of the grid's recordsource to Company + Department and then they can Ctril+Click on the Surname column header and the full sort order will get set to Company + Department + Surname
Some thoughts here --
I can see the first click handling the first column as the selection and then set an order on that column; this is easy enough. Now when the user selects the second column with a Ctrl-Click, the program would have to get the first column selected (with the simple click) and then set the order on the combination of the two fields. Now the tricky part -- the user selects the third column (or any subsequent columns) with another Ctrl-Click -- how to know this is the third or later click?
I would suggest building the index definition in a string on the grid class stored as a custom property. Each time the user selects just a mouse click (no Ctrl key) then this string is reset with just the column selected. Now when the user selects a column to next sort on via a Ctrl-Mouse click, you add that column to the string. I would also suggest that you display the contents in the grid from a cursor and then build the indexes on the fly.
You also need to check that the user is not double selecting a column. While the index expression would not complain, I don't think it would make much sense but only add overhead to the index.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only