Solved

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

Posted on 1998-09-13
8
202 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
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 …

791 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