Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to change the caption of a MessageDlg Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
21-Oct-02
Category
Dialogs
Language
Delphi 2.x
Views
155
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How to change the caption of a MessageDlg

Answer:

Build your own:
1   
2   function MyMessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons:
3     TMsgDlgButtons;
4     const ACaption: string = 'Hi'; DefaultButtonIndex: Integer = -1; HelpCtx: Longint 
5   =
6       0): Integer;
7   var
8     Index: Integer;
9     ButtonIndex: Integer;
10  begin
11    with CreateMessageDialog(Msg, DlgType, Buttons) do
12    try
13      HelpContext := HelpCtx;
14      if ACaption <> '' then
15        Caption := ACaption;
16      if DefaultButtonIndex >= 0 then
17      begin
18        ButtonIndex := -1;
19        for Index := 0 to ControlCount - 1 do
20        begin
21          if Controls[Index] is TButton then
22          begin
23            Inc(ButtonIndex);
24            TButton(Controls[Index]).default := ButtonIndex = DefaultButtonIndex;
25            if ButtonIndex = DefaultButtonIndex then
26              ActiveControl := TButton(Controls[Index]);
27          end;
28        end;
29      end;
30      Result := ShowModal;
31    finally
32      free;
33    end;
34  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC