Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Delphi Example - MessageDlg

1 view
Skip to first unread message

Richard

unread,
Jan 17, 2005, 10:53:17 PM1/17/05
to
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
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 =---

J French

unread,
Jan 18, 2005, 3:04:44 AM1/18/05
to
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....
>
>
>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);

Richard

unread,
Jan 18, 2005, 7:09:41 AM1/18/05
to
Yes, I gathered removing the last button type allows it to compile. Delphi
7 Pro Help/Examples - MessageDLG.
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.

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....

J French

unread,
Jan 18, 2005, 8:24:34 AM1/18/05
to
On Tue, 18 Jan 2005 06:09:41 -0600, "Richard" <rwskinner ATawesomenet
Dot net> wrote:

>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

Rob Kennedy

unread,
Jan 18, 2005, 11:43:16 AM1/18/05
to
Richard wrote:
> Straight from the Delphi Help / Examples - Does not compile - Parameters
> incorrect.

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

Jamie

unread,
Jan 18, 2005, 4:41:35 PM1/18/05
to
that's a first
should be
MessageDlg('Welcome to my Delphi application. Exit Now?',
mtConfirmation, [mbok,mbNo],0);

the last Parameter should not exists.

MikeB

unread,
Jan 18, 2005, 1:19:58 PM1/18/05
to

> 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.


0 new messages