Solved

coloring the message dialog..

Posted on 2000-04-21
6
151 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

706 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

19 Experts available now in Live!

Get 1:1 Help Now