Solved

howto: changing the caption of button in common dialog control ?

Posted on 1998-09-13
8
203 Views
Last Modified: 2012-05-04
Hi experts,

The common dialog control has a command button with the
caption "open". How can I change this caption to
"delete" ?


Any suggestions for a solution ?

With kind regards
0
Comment
Question by:mathes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1339617
I think this can't be done.....

You can change the title though...

OpenDialog1.Title := 'Delete File...';

Regards,
Viktor Ivanov
0
 
LVL 2

Expert Comment

by:kjteng
ID: 1339618
Create your own dialog box. That isn't difficult.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1339619
Well, I think it is in some ways . o O

Regards,
Viktor Ivanov
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:BlackDeath
ID: 1339620
hi, mathes:

this is a simple example of how to build your own dialog (this one was for "select directory", which i didn't want to use the OpenDialog for):

unit Dlg_dir;

interface

uses
  SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  Forms, Dialogs, ExtCtrls, StdCtrls, Buttons, FileCtrl;

type
  TdlgChooseDir = class(TForm)
    lbDir: TDirectoryListBox;
    lbDrive: TDriveComboBox;
    btnOK: TBitBtn;
    btnCancel: TBitBtn;
    Label1: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure btnOKClick(Sender: TObject);
    procedure btnCancelClick(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure lbDirKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    boChanged: Boolean;
    { Private declarations }
  public
    { Public declarations }
    Path : String;
  end;

var
  dlgChooseDir: TdlgChooseDir;

implementation

{$R *.DFM}

procedure TdlgChooseDir.btnOKClick(Sender: TObject);
begin
  if boChanged then begin
    lbDir.OpenCurrent;
    boChanged := False;
  end
  else begin
    Path := lbDir.Directory;
    ModalResult := mrOK;
  end;
end;

procedure TdlgChooseDir.btnCancelClick(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TdlgChooseDir.FormShow(Sender: TObject);
begin
  Label1.Caption := lbDir.Directory;
  boChanged := False;
end;

procedure TdlgChooseDir.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    VK_RETURN: btnOKClick(Sender);
    VK_ESCAPE: btnCancelClick(Sender);
    $4C      : ActiveControl := lbDrive;
    $4F      : ActiveControl := lbDir;
  end;
end;

procedure TdlgChooseDir.lbDirKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    VK_UP: boChanged := True;
    VK_DOWN: boChanged := True;
    VK_RETURN: btnOKClick(Sender);
  end;
end;

end.

modify til it fits your needs.

Black Death.
0
 
LVL 1

Expert Comment

by:BlackDeath
ID: 1339621
ach ja:

the three labels:
Label4: '&Ordner'     ($4C)
Label3: '&Laufwerke'  ($4F)
Label1: for the display of the selected directory
- sorry, it's german -

or gimme your eMail & i'll send you the whole thing.

Black Death.
0
 

Author Comment

by:mathes
ID: 1339622
I must reject victors reply, because I don't want to change the title.

I know that the caption ofthe command button can be changed, because I have seen this in a sample source code. Unfortunately I can't remember the location of thi source code. It was either in the demo sources of Delphi, or somewhere in the WWW.
I will think about the idea to create my own dialog. However this solution has one setback: It is not 100% compatible with the look and feel of other windows applications. My e-mail address is: circe@muc.de
I don't mind recieing comments in German language, because I am a native German, so German is my mother tongue.
0
 

Author Comment

by:mathes
ID: 1339623
Hi Blackdeath: Can you please resend me your code? Due to technical problems I lost this mail.

With kind regards

Christian
0
 

Accepted Solution

by:
manolis_afentakis earned 50 total points
ID: 1339624




make first sure that u have the vcl source installed.
 .. then search for the implementation
 .. alter it and put the pas-file into your bin path...


good luck...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 92
Base1 Encode/Decode 3 86
delphi popmenu non latine charcters 3 34
How to add columns to a RAD Studio FMX grid at design time 1 32
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question