procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('Welcome to my Delphi application. Exit now?',
mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
begin
MessageDlg('Exiting the Delphi application.', mtInformation,
[mbOk], 0, mbOk);
Close;
end;
end;
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
>Straight from the Delphi Help / Examples - Does not compile - Parameters
>incorrect.
>I also thought it was cool to put the default button after the help
>parameter, but Delphi complains that there are too many parameters....
>
>
>procedure TForm1.Button1Click(Sender: TObject);
>begin
> if MessageDlg('Welcome to my Delphi application. Exit now?',
> mtConfirmation, [mbYes, mbNo], 0, mbYes) = mrYes then
Lose the last mbYes
Is this really straight from the examples ?
If so which version of Delphi ?
This is the D4 example :-
procedure TForm1.Button1Click(Sender: TObject);
begin
if MessageDlg('Welcome to my Object Pascal application. Exit now?',
mtConfirmation, [mbYes, mbNo], 0) = mrYes then
begin
MessageDlg('Exiting the Object Pascal application.',
mtInformation,
[mbOk], 0);
I think it is suppose to simply show a dotted frame around the button saying
if you press enter, this will be the default button....
Richard
"J French" <ere...@nowhere.uk> wrote in message
news:41ecc1a2....@news.btclick.com...
> On Mon, 17 Jan 2005 21:53:17 -0600, "Richard" <rwskinner ATawesomenet
> Dot net> wrote:
>
> >Straight from the Delphi Help / Examples - Does not compile - Parameters
> >incorrect.
> >I also thought it was cool to put the default button after the help
> >parameter, but Delphi complains that there are too many parameters....
>Yes, I gathered removing the last button type allows it to compile. Delphi
>7 Pro Help/Examples - MessageDLG.
Interesting
>But, the help also shows, that the Default Button selection can be entered
>as a optional parameter directly after the help index parameter, thus there
>example code.
And that is the case
if MessageDlg('Welcome to my Object Pascal application. Exit now?',
mtConfirmation, [mbYes, mbNo], 0 <===== that blighter ======
) = mrYes then
>I think it is suppose to simply show a dotted frame around the button saying
>if you press enter, this will be the default button....
True - the default
Either Delphi7 has faulty Help files
- or you have a glitch in your Ctl C - Ctl V
I have seen some bugs in the examples before (can't remember which
ones) but the best thing is to remember that the Delphi programmers do
not write the Help Files
- hence there is a lot missing from them
- and also they can be obscure/misleading
The moral is - Don't believe everything you read - check it out
You need to be careful about whether you're looking at the VCL section
of the help or the CLX section. QDialogs defines more MessageDlg
overloads than Dialogs does.
--
Rob
the last Parameter should not exists.
The D7 Dialogs Unit doesn't have the overloaded function. QDialogs does. The
Help file example just doesn't identify to which it belongs.