Solved

coloring the message dialog..

Posted on 2000-04-21
6
155 Views
Last Modified: 2010-04-04
Is there a way to display a message dialog with customised colours.?
I am using the "messagedlg()" command.
0
Comment
Question by:tanm
6 Comments
 
LVL 2

Expert Comment

by:rene100
ID: 2737884
Hi

I think this isn't possible, because MessageDlg() uses a windows-api-function to display the messagebox....
The colors of the msgbox are determined by the system settings, so you could change these settings..


regards
rene
0
 

Accepted Solution

by:
d32coder earned 10 total points
ID: 2738182
No, but you can create a new Form that emulates the messagebox.  That way you can customize it completely.

This is not considered good code but it will give you more options.
0
 

Expert Comment

by:PascalCP
ID: 2738306
Hi,

It is not possible without creating your own form ! Because windows is calling an API .
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:SuperSy
ID: 2739213
Not necessarily ... I think you can override the CreateMessageDialog() for that ...

Let me check.
0
 

Expert Comment

by:SuperSy
ID: 2739235
Ok ... my answer is "Yes", according to the question.  The question simply says "Is there a way...?" and yes, there is.  Not with MessageDlg(), but there sure is.  And except for the color, the dialog looks exactly like the one with MessageDlg().

If you are willing to change all the MessageDlg() commands in your app to, say, MyMessageDlg(), you can change the background of your boxes to a different color.  

Of course, you have to write your own MyMessageDlg like this:

function MyMessageDlg(const Msg: string; DlgType: TMsgDlgType; Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;
begin
  with CreateMessageDialog(Msg, DlgType, Buttons) do
  begin
    try // ..finally
      HelpContext := HelpCtx;
      // Let's try red
      Color := $000000FF;
      Result := ShowModal;
    finally
      free;
    end; // try
  end;
end;

If you try, you can see that only the background is red; the buttons are still grey.  

Now that I think of it, what I did is exactly what d32coder said... I have created a new Form that emulates the messagebox, with a coloring twist.  I just created the form using code supplied by Delphi.

I personally will consider this good enough code.  ^_^

By the way, if you want to change the button colors as well, do post a comment here.  
0
 

Author Comment

by:tanm
ID: 2739515
Brilliant! That's is precisely what i need..
Thanks very much..
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

920 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

20 Experts available now in Live!

Get 1:1 Help Now