Too many actual parameters (message dialog)

I inherited a program that has a number of problems with it. The last one is a warning about too many valid parameters:

if MessageDlgPos('IS THIS CORRECT? ' , mtConfirmation, **[mbyes, mbno], 0, 400, 450, mbno) = mrno then begin** edtPstvEmplyNmbr.SetFocus; xitFlg:= True; 

The greasy part is where the error stands out.

Note: WORKS program, just not on my machine. It was developed using the same version of Delphi (7), but in the environment of clx (kylix). I think I (can) solved all the incompatibility issues between clx and vcl (my current environment), but it may be that I am missing the component that generates this error. I will do my best to clarify any issues, but please remember that I have only been developing Delphi for several months.

+4
source share
1 answer

Delphi VCL and Kylix CLX are not fully compatible. In particular, some of these functions perform different parameters, as you learned first hand.

Modern versions of Delphi support the version of MessageDlgPos that you are trying to call, but it is obvious that Delphi 7 does not. It is likely that CLX introduced an overload with seven arguments when the VCL version had only six arguments, and then a later version of Delphi transferred the CLX version back to VCL. Keep in mind that Delphi 7 is older than a decade.

To find out which versions of a function are available for use, see the "Dialogs" section.

If you have a version with six arguments, you can simply remove the last parameter, and then just deal with the fact that the default button may not be what you want. Another alternative is to call MessageBox , which allows you to specify the default button due to the ability to specify the position of the window.

+5
source

All Articles