Set focus to the OK button in the TPrintDialog

192 Views Asked by At

Is it possible to set focus to the OK button in the TPrintDialog when it opens?

1

There are 1 best solutions below

1
Remy Lebeau On BEST ANSWER

In the TPrintDialog::OnShow event, you can manually set focus to the OK button like this:

void __fastcall TMyForm::PrintDialogShow(TObject *Sender)
{
    HWND btnOK = GetDlgItem(PrintDialog->Handle, IDOK);
    ::SetFocus(btnOK);
}