Solved

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

Posted on 2003-11-07
7
205 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi custom sort exception 6 135
Delphi procedure  - Unsatisfied forward or external declaration. 2 142
Path  to current project in Delphi. 2 72
LAN or WAN ? 11 82
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now