Datagrid delete without a button

  • Thread starter Thread starter bie2
  • Start date Start date
B

bie2

Hi,

I have a datagrid with many records, I want to delete all of them.
I'm doing CTRL-A and press delete...I take a long time to delete it and
the UI is froze during that time.

So I would like to make this delete in a worker thread, but how can I
catch the delete command before it happen??

I'm doing a windows app.

A solution I have is capture the keypress event and see if it's delete
has been pressed and if a complete row has been selected and do the
worker thread there.

But is there an event generated like on the web datagrid, that have a
DeleteCommand event.

Thanks
Frank
 
Hi,

That's right - there's no such event. But you have another way - deriving a
new control from the grid and overriding some virtual methods.
The ones you will need are:

ProcessCmdKey
PreProcessMessage

Check for the WM_KEYDOWN message to catch the 'Del' keypress, and also check
for WM_SYSKEYDOWN sent when the user presses "Alt-Del" (yes, this shortcut
also works in the grid).
 
Back
Top