Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
497 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (4)


Change the looks of a MessageDlg...Format this article printer-friendly!Bookmark function is only available for registered users!
Product:
Delphi all versions
Category:
N/A
Skill Level:
Scoring:
Last Update:
06/05/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet Delphi Delphi3000 MessageDlg
Times Scored:
5
Visits:
2617
Uploader: Smokey Mc. Pot
Company:
Reference: N/A
 
Question/Problem/Abstract:
How can I change the looks of a MessageDlg ???
Answer:



procedure TForm1.Button1Click(Sender: TObject);
var  
  f: TForm;
begin
  // Create the MessageDialog
  f := Dialogs.CreateMessageDialog('HELLOWORLD', dialogs.mtInformation, dialogs.mbOKCancel);

  // Set the backcolor to blue.
  f.Color := clBlue;

  // Set textcolor to lime
  f.Font.Color := clLime;

  // Show the dialog and wait for the modalresult to see which button is clickt
  if f.ShowModal = mrOk then
    ShowMessage('OK Pressed, OK wurde gedrückt')
  else
    ShowMessage('Cancel pressed. Abbrechen wurde gedrückt');
end;


"Wise Men Don't Need Advice, Fools Don't Take It"

"I Don't Want To Achieve Immortality Through My Work,
I Want To Achieve It By Not Dying"





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
Message Dialog
    Nenad Fidanovski (Jun 18 2002 10:55AM)

Is it possible to change the buttons. i,e to change the text in the buttons
like instead of "Yes" to write "Confirm".

Tks Nenad
Respond

RE: Message Dialog
Abdulaziz Jasser (Jun 21 2002 8:08PM)

Yes, it possible.  You can do that by looping the components of the dialog and see which one is a button and then change the caption.  Example:

..................................................................................................
var
          i : Integer;
          f : TForm;
begin
          f := Dialogs.CreateMessageDialog('', dialogs.mtInformation, dialogs.mbOKCancel);

          for i:=0 to f.ComponentCount-1 do begin
              if f.Components[i] is TButton then begin
                 if TButton(f.Components[i]).Caption = 'OK' then
                    TButton(f.Components[i]).Caption := 'my OK';

                 if TButton(f.Components[i]).Caption = 'Cancel' then
                    TButton(f.Components[i]).Caption := 'my cancel';
              end;
          end;
..................................................................................................
Respond

Next time do not copy the other's work.
    Abdulaziz Jasser (Jun 6 2002 12:11PM)

You did not even change anything to make it yours.  For the readers, this guy copied this article as it is from this site:

http://www.swissdelphicenter.ch/en/showcode.php?id=1168
Respond

RE: Next time do not copy the other's work.
Smokey Mc. Pot (Jun 7 2002 8:38PM)

I never said I came up the this code myself, and I never asked for credits, so basicly the only thing I did is post it on delphi3000.com cause it was not on it.....

if you've got any problems with that sue me....
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
M. Shkolnik
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)