When the user double-clicks dbgrid, I show a modeless form.
When they close this form, I want to update the grid.
For this, I tried the following:
1 - Define the custom message constant:
const
WM_REFRESH_MSG = WM_USER + 1;
2 - In the OnClose event of my modeless form, I have the following:
procedure TMyNonModalForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
PostMessage(Self.Handle,WM_REFRESH_MSG,0,0);
end;
3 - In private declarations of a form containing dbGrid, I have the following:
procedure OnRefreshRequest(var Msg: TMessage); message WM_REFRESH_MSG;
...
procedure TMyFormWithADBGrid.OnRefreshRequest(var Msg: TMessage);
begin
RefreshGrid;
end;
After completing these steps, PostMessage works fine, but the OnRefreshRequest procedure never starts. What am I doing wrong?
source
share