Solved

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

Posted on 2003-11-07
7
204 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
Comment Utility
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
Comment Utility
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
Comment Utility
Ah - same for the onclick part.

So try

x : TNotifyEvent;
y : TNotifyEvent

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

if ( x = y ) then..
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:moonrise
Comment Utility
same error
0
 
LVL 12

Expert Comment

by:andrewjb
Comment Utility
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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 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

15 Experts available now in Live!

Get 1:1 Help Now