Hi!
How can I catch the click on the title column on a CRDBGrid with sort enabled, before sort is executed, so I can , under certain rules, cancel the sort?
Thanks.
CRDBGrid -> How to catch click on sort column before sort?
The TCRDBGrid component doesn't have such feature. But you can edit its source code to add this feature. For example, add to TCRDBGrid a new event:
Then call this event handler from the MouseUp method of TCRDBGrid.
Code: Select all
type
TBeforeSort = procedure(Sender: TObject; Column: TColumn; var EnableSort: boolean) of object;Code: Select all
...
if TCRColumn(Column).CanBeSorted and (dgeEnableSort in OptionsEx)
and MouseInLowerstLevel(X,Y,Column) and (LastBtn = Column.Index)
then begin
SortEnabled := True;
if Assigned(FBeforeSort) then
FBeforeSort(Self, Column, SortEnabled);
if SortEnabled then begin
...