Solved

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

Posted on 1998-09-13
8
197 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now