?
Solved

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

Posted on 1998-09-13
8
Medium Priority
?
210 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 100 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

765 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