Default
Google

How can I change the caption of OpenDialog's buttons?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

The standard OpenDialog comes with two (or more) buttons: Open and Cancel. I would like to change the caption of these buttons. How?
 
 
 1.
  Start a new application.
 
 2.
  Add an OpenDialog. Edit its OnShow event:
 
void __fastcall TForm1::OpenDialog1Show(TObject *Sender)
{
    SendMessage(GetParent(dynamic_cast<TOpenDialog*>
        (Sender)->Handle), CDM_SETCONTROLTEXT, IDOK,
        (long)"&Go");
 
    SendMessage(GetParent(dynamic_cast<TOpenDialog*>
        (Sender)->Handle), CDM_SETCONTROLTEXT, IDCANCEL,
        (long)"&Don't Go");
}
 
 3.
  Add a Button. Edit its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    OpenDialog1->Execute();
}

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange