Overwriting a built in function?

  • Thread starter Thread starter Sargas Atum
  • Start date Start date
S

Sargas Atum

I have to sort the contents of each column, by default you can sort the
column just on clicking on the column head.

That works by default. I have to sort another column by the contents of
the next column, I have already written the sorting functions, the are
trivial.

The problem is by now, I can activate my sorting menu only from the
right mouse button, but I would like to do it from the left,
unfortunatly there lies already the default sorting.

Does anybody have an example for overwriting this built in function?

thx
a.s.
 
Sargas,

Since the mouse events don't provide a cancel operation, what you could
do is override the WndProc method. In this method, handle the
WM_LBUTTONDOWN message. When you do this, check to see if the column header
is being clicked (this is what triggers the sort). You can figure this out
by calling the HitTest method on the DataGrid. If it is on the header, then
call your code, otherwise, have the base handler handle the message.

Hope this helps.
 
Back
Top