[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 1998-09-13
8
Medium Priority
?
221 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
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…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Suggested Courses
Course of the Month17 days, 16 hours left to enroll

829 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