Search code examples
delphic++builderfiremonkey

How do I set a form's focus so that no control has the focus in FireMonkey?


Using C++ Builder XE6 and FireMonkey, how do I set a form's focus so no control has the focus?

I know that I can call SetFocus () on a control, but I don't want any specific control to have the focus.


Solution

  • In Delphi you can set the form's Focused property to nil, e.g.:

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Focused := nil;
    end;
    

    In C++ Builder it could be:

    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
      Focused = NULL;
    }