Mirror

How to change the button caption in a TOpenDialog (Views: 100)


Problem/Question/Abstract:

I need a dialog for the user to select files to delete. The TOpenDialog works just fine except that the button says Open, and I need it to say Delete.

Answer:

You will need to include Commdlg in your uses clause. In the TOpenDialog.OnShow event:

procedure TForm1.OpenDialog1Show(Sender: TObject);
begin
  SendMessage(GetParent(OpenDialog1.Handle), CDM_SETCONTROLTEXT, 1,
    Integer(PChar('Delete')));
end;

<< Back to main page