?
Solved

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

Posted on 2003-11-07
7
Medium Priority
?
211 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses

807 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