Bob Penoyer
Bob Penoyer

Reputation: 99

Set focus to the OK button in the TPrintDialog

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

Upvotes: 0

Views: 210

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 597906

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);
}

Upvotes: 2

Related Questions