 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Ralph van Roosmalen Guest
|
Posted: Tue Oct 14, 2003 11:01 am Post subject: Strange behaviour Delphi Compiler |
|
|
Hi,
First, sorry if this is the wrong newsgroup for this "problem". I can't find
a better newsgroup, so if you have one please let me know.
I found a construction in our project, where you would expect a compiler
message but the compiler doesn't complain, the construction works with no
errors.
unit Unit1;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
public
function MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: LongInt; pYesOkDefault: Boolean = True): Integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//No comma between the string test and mtWarning!
MessageLng('TEST' mtWarning,[mbok],0,true);
end;
function TForm1.MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: Integer; pYesOkDefault: Boolean): Integer;
begin
Beep;
end;
Is this a bug in the Delphi compiler or a new Delphi statement that I never
read about? I expect the compiler to complain about not enough parameters or
something.
We are using Delphi 6 with service pack 2.
Thanks in advance.
Ralph van Roosmalen
Planon b.v.
|
|
| Back to top |
|
 |
Kurt Barthelmess Guest
|
Posted: Tue Oct 14, 2003 2:18 pm Post subject: Re: Strange behaviour Delphi Compiler |
|
|
"Ralph van Roosmalen" <ANTIr.vroosmalen (AT) planon (DOT) nlSPAM> wrote:
| Quote: | function MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: LongInt; pYesOkDefault: Boolean = True): Integer;
//No comma between the string test and mtWarning!
MessageLng('TEST' mtWarning,[mbok],0,true);
function TForm1.MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: Integer; pYesOkDefault: Boolean): Integer;
begin
Beep;
end;
Is this a bug in the Delphi compiler or a new Delphi statement that I never
read about? I expect the compiler to complain about not enough parameters or
something.
We are using Delphi 6 with service pack 2.
|
I do get a "Not enough actual parameters error". (D6 service pack 2
also.) Are you sure there's not something else involved here? An
overloaded method, third party routines, etc.?
If you run the app and click on the button, does your MessageLng
routine get called?
Good luck.
Kurt
|
|
| Back to top |
|
 |
Sasan Adami Guest
|
Posted: Tue Oct 14, 2003 8:48 pm Post subject: Re: Strange behaviour Delphi Compiler |
|
|
Ralph van Roosmalen wrote:
| Quote: | procedure TForm1.Button1Click(Sender: TObject);
begin
//No comma between the string test and mtWarning!
MessageLng('TEST' mtWarning,[mbok],0,true);
end;
function TForm1.MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: Integer; pYesOkDefault: Boolean): Integer;
begin
Beep;
end;
Is this a bug in the Delphi compiler or a new Delphi statement that I never
read about? I expect the compiler to complain about not enough parameters or
something.
We are using Delphi 6 with service pack 2.
|
Hi Ralph,
Looks like a bug. I can reproduce it using Delphi 5 (sp1) and Delphi 6
(sp2). The default parameter is the "problem". If you remove the default
value for pYesOkDefault the compiler will complain as expected: "not
enough parameters".
It seems to be solved in D7.
Groet,
Sasan.
|
|
| Back to top |
|
 |
Paul van Kan Guest
|
Posted: Wed Oct 22, 2003 8:37 pm Post subject: Re: Strange behaviour Delphi Compiler |
|
|
I guess it's time to switch to D7, Ralph.
;-)
Paul van Kan
Kanumo Software Services
"Ralph van Roosmalen" <ANTIr.vroosmalen (AT) planon (DOT) nlSPAM> schreef in bericht
news:3f8bd78d (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
First, sorry if this is the wrong newsgroup for this "problem". I can't
find
a better newsgroup, so if you have one please let me know.
I found a construction in our project, where you would expect a compiler
message but the compiler doesn't complain, the construction works with no
errors.
unit Unit1;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
public
function MessageLng(const Msg: String; DlgType: TMsgDlgType; Buttons:
TMsgDlgButtons; HelpCtx: LongInt; pYesOkDefault: Boolean = True): Integer;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
//No comma between the string test and mtWarning!
MessageLng('TEST' mtWarning,[mbok],0,true);
end;
function TForm1.MessageLng(const Msg: String; DlgType: TMsgDlgType;
Buttons:
TMsgDlgButtons; HelpCtx: Integer; pYesOkDefault: Boolean): Integer;
begin
Beep;
end;
Is this a bug in the Delphi compiler or a new Delphi statement that I
never
read about? I expect the compiler to complain about not enough parameters
or
something.
We are using Delphi 6 with service pack 2.
Thanks in advance.
Ralph van Roosmalen
Planon b.v.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|