4

I have inherited a program that has a number of issues with it. The latest one is a Too Many Actual Parameters warning:

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

The bold portion is where the error highlights.

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

LU RD
  • 34,438
  • 5
  • 88
  • 296
user
  • 619
  • 8
  • 17
  • 1
    Place your cursor inside the parenthesis and hit Ctrl+Shift+Space. The IDE will show you any possible parameter combinations you can use. It sounds to me that the klx environment has a different overloaded version of MessageDlgPos than the vcl, so you will have to check if the desired functionality is still there. – R-D Jan 03 '13 at 20:35
  • Jerry, tried to add the clx tag, but I haven't leveled up enough. – user Jan 03 '13 at 20:44
  • Roald, I will try your technique when I have a spare moment and post results. – user Jan 03 '13 at 20:45
  • Roald, tried Ctrl+Shift+Space. "Unable to invoke Code Parameters due to errors in source code". – user Jan 03 '13 at 21:23

1 Answers1

5

Delphi's VCL and Kylix's CLX are not fully compatible. In particular, some like-named functions take different numbers of parameters, as you've learned first-hand.

Modern versions of Delphi support the version of MessageDlgPos that you're trying to call, but it's apparent that Delphi 7 does not. What probably happened was that CLX introduced the seven-argument overload when the VCL version only had six arguments, and then a later Delphi version ported the CLX version back to the VCL. Keep in mind that Delphi 7 is over a decade old.

To see which versions of the function are available to use, look in Dialogs.pas.

If you have the six-argument version, you might be able to simply remove the last parameter, and then just deal with the fact that the default button might not be what you want to be. Another alternative is to call MessageBox, which will let you specify the default button at the expense of being able to specify the window position.

Rob Kennedy
  • 161,384
  • 21
  • 275
  • 467