delphifocusdelphi-7

How to remove focus from currently focused component?


I have a DB component which DataLink.UpdateRecord is called when it receives CM_EXIT message. This message is sent when it loses focus. When I click post button, it doesn't lose focus and value is not written to datasource. How can I reach an effect of component losing focus without switching it to other one?


Solution

  • You could use:

    procedure TCustomForm.DefocusControl(Control: TWinControl; Removing: Boolean);