Solved

if (ButtonAccept.OnClick = ButtonAcceptClick) then ... Not enough parameters

Posted on 2003-11-07
7
207 Views
Last Modified: 2010-04-05
At some point in my program I assign one of different available procedures to ButtonAccept.OnClick

I want to use that value in an if clause but when I use the code

 if (ButtonAccept.OnClick = ButtonAcceptClick)  then

then I get a compile error not enough parameter

0
Comment
Question by:moonrise
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:andrewjb
ID: 9702869
without delphi to hand...

try @ButtonAcceptClick
or maybe ^ButtonAcceptClick

though I'm not sure.

If that don't work, try

  x : TNotifyEvent;

x = ButtonAcceptClick;

if ( ButtonAccept.OnClick = x ) then ....
0
 

Author Comment

by:moonrise
ID: 9703078
Tried all 3 suggestions, always the same error - not enough parameters and the cursor is positioned right after the =

strange...
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 9703146
Ah - same for the onclick part.

So try

x : TNotifyEvent;
y : TNotifyEvent

x := ButtonAccept.OnClick;
y := ButtonAcceptClick;

if ( x = y ) then..
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:moonrise
ID: 9703170
same error
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 9703185
Flippin 'eck. Hang on, then. Let's see if I can find a copy of Delphi...
0
 
LVL 12

Accepted Solution

by:
andrewjb earned 125 total points
ID: 9703239
OK - I was nearly right first time.

You need to use '@' to say ' the address of the function', otherwise it thinks you're trying to call it (which is what the 'not enough parameters' means)

So, back to your original,

instead of:

if (ButtonAccept.OnClick = ButtonAcceptClick)  then

you need

if (@ButtonAccept.OnClick = @ButtonAcceptClick)  then
0
 

Author Comment

by:moonrise
ID: 9703269
great, got a combination that works - your last one was very close, except that @ has to be used with a variable

  x : TNotifyEvent;

    x := ButtonAcceptClick;

if @ButtonAccept.OnClick = @x ....

thank you for your help
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question