I have a DBGrid, and I want to disable the mouse click when record is in edit state. I use the following procedure for the keydown. That works for when I press the down or up key on the keyboard, but NOT for the mouse. I still can change to another record by clicking with the mouse, even when in edit state.
procedure Tf_inkfak.DBGrid3KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if DBGrid3.Selectedfield.displaylabel = 'GRB_REK' then if dbdata.fininkrg.state in [dsedit] then if Key in [VK_UP,VK_DOWN] then abort;
end;
When I use the events mouseup and mousedown in DBGrid, with this code:
if GetKeyState(VK_LBUTTON) and $8000 <> 0 then abort;
does not work, because the event is AFTER the mouse click and not before. So record is saved and goes to the other click record. And that's not what I want.
How can I disable the mouse clicks when record is in edit state.
Thanks in advance Hans