Incorrect parameter for custom event handler

c++ builder

    Sponsored Links


  • 1. Model-View-Controller Pattern
    Hi, How could I implement MVC pattern with C++Builder to have controller layer code out of Forms code?
  • 2. BCB2006: package description
    Hello, 1. How can i set the package description, if the package is created as a C++ package. 2. When C++ packages contain .pas files, it seems that, when building, only .hpp and .obj files are created. What option should be set on, to generate .dcu files. These are needed, when one has another package with .pas files, containing uses clause with units from the first package. Thanks for any suggestion jarek
  • 3. ZEOSLIB Port
    Hi all, I am trying to port ZEOSLIB which is an open source native database connectivity library. It builds fine under C-Builder 5 & 6, but I am not able to compile it under Developer Studio 2006. The library has 5 modules each dependent upon the previous; a build order. The first module, ZCore.bpl, builds fine and it includes a file called ZClasses.pas. The second module fails to build with the following error message: [Pascal Fatal Error] ZGenericSqlToken.pas(45): F2063 Could not compile used unit 'ZClasses.pas' This is the only error I get. When I google around for this error, I find it but I always find it with other errors that come before it that seem to cause this. In my case, this is the only error I am getting and I don't know object pascal to save my life. So why would this build fine under CB-5 and CB-6 but not under Studio 2006? When I pulled the source up into Studio 2006, I did so from the CB-5 source and I was prompted to convert the project sets to the new format which I did. Any advise would be greatly appreciated. Thanks much! ~Eric
  • 4. [BCB6] Published class property name
    Hi, I am writing a Component with a custom class as sub component witch is created inside my component's class. Everything works fine, but i get a strange behavior from the object inspector: If i put a TAOCRadioButton on my form, witch the name is "AOCRadioButton1", the OPCTag property is assigned with "AOCRadioButton1->". What happends ? here are the involved class defs Thanks //My subcomponent custom class class PACKAGE TAOCTag : public TAOCTagObject { private: protected: //Redinition de UpdateValue virtual void __fastcall UpdateValue(Variant Value,TDateTime TimeStamp); public: friend class TAOCRadioButton; //Constructeur __fastcall TAOCTag(TComponent* Owner); __published: //Publication de WriteOnly __property OpcWriteOnly; }; //My component class class PACKAGE TAOCRadioButton : public TRadioButton { private: TAOCTag* FAOCTagObject; TAOCTag* __fastcall GetFAOCTag(void); void __fastcall SetFAOCTag(TAOCTag*); protected: //Redinition de On Clic pour mise jour vers client OPC virtual void __fastcall AOCRadioBtnClic(TObject *Sender); public: //Constructeur __fastcall TAOCRadioButton(TComponent* Owner); //Destructeur __fastcall virtual ~TAOCRadioButton(); __published: //Tag li __property TAOCTag *OpcTag = {read=FAOCTagObject,write=FAOCTagObject}; }
  • 5. BCB5:Some observations when inserting components into a custom component
    Hello, how can inserting a component into a custom component be prevented at design time. When inserting e.g. a button into the custom component, something gets into trouble, according to the error messages. The next question is, what has to be done to make inserting components into custom components possible, and whether this is possible at all. The custom component I'm trying with is derived from a class itself derived from TFrame. It contains an OK button named Button1. There is one more problem, when trying to insert another OK button somewhere into the form the custom component is in, there are annoying messages, that Button1 is already used in the form. Regards, Sascha Michel

Incorrect parameter for custom event handler

Postby Myles Rippenhagen » Wed, 26 Oct 2005 02:43:50 GMT


I have created several custom components and generally have had great 
success with them, but I am currently running into a problem where when I 
double-click on a published custom event (on the "Events" tab of the "Object 
Inspector" in the IDE), the inserted method declaration contains the wrong 
variable name.  The signature matches another, similar custom event, and it 
seems to be picking up the parameter name from this other definition.  I 
have double-checked that I am referencing the correct typedef in the 
definition of my custom component and I didn't see any problem.  I am using 
BCB6 Enterprise on WinXP.  Following are the important bits of the code.

typedef void __fastcall (__closure *BeforePostEvent) (TObject* Sender, bool 
typedef void __fastcall (__closure *OnPutToDatabaseEvent) (TObject* Sender, 
bool &DoDefault);
   OnPutToDatabaseEvent FOnPutToDatabaseEvent;
   __property OnPutToDatabaseEvent OnPutToDatabase = 
{read=FOnPutToDatabaseEvent, write=FOnPutToDatabaseEvent};

When I double-click on the "OnPutToDatabase" event in the IDE, the inserted 
code labels the bool parameter "CanPost" instead of "DoDefault".  It appears 
to just pick up the first typedef with a matching signature instead of using 
the typdef that I specified.

Any suggestions??

Re: Incorrect parameter for custom event handler

Postby Remy Lebeau (TeamB) » Wed, 26 Oct 2005 03:12:24 GMT

That is a long-standing known issue.  The OI matches events by signatures
only, not names.  You have two different events that have the exact same
signature (return value, calling convention, parameter data types, and
parameter ordering).  The OI always generates code using the first event
type that matches the required signature.

That is exactly why you are seeing what you have described.  There is
nothing you can do to prevent the OI from behaving that way.  You will just
have to change the signature of one of your events so that they no longer
match each other.

The OI does not care about typedefs.  It only cares about signatures.


Similar Threads:

1.Why event handler first parameters are incorrect

I noticed that DataGridView CellValidated() and other event handler first 
parameter is object:


        void Grid_CellValidated(object sender, DataGridViewCellEventArgs e) 

Why ? Correct signature must be

void Grid_CellValidated(DataGridView sender, DataGridViewCellEventArgs e) {


2.Custom event handler

Hello, all.  I am trying to develop my first component and I am trying to
figure something out.  I created a MouseMove event handler for my component
(TMyComponent::MouseMove) and it works fine.  I added my component to a new
project (TMyComponent *MyComponent1) and I want perform a task in the
MyComponent1MouseMove event.  My problem is that the TMyComponent::MouseMove
function is executing, but the TForm1::MyComponent1MouseMove function is
not.  I set the OnMouseMove event to MouseMove for the MyComponent1
instance, but it still only calls the component handler, not the custom
handler.  Why won't it call my custom handler?  Actually, I will need both
functions to execute.  Will I need to explicitly call
TMyComponent::MouseMove() from within the TForm1::MyComponent1MouseMove
function to get both to execute?  Any feedback will be greatly appreciated.



3.Custom event handlers in .NET Winforms

4.Custom Event Handler

I am getting an error down below, this same code works in VB, what gives?

private void Form1_Load(object sender, System.EventArgs e)


System.Windows.Forms.LinkLabel l = new System.Windows.Forms.LinkLabel();

FileSystemWatcher watcher = new FileSystemWatcher();

watcher.Path = @"C:\TempFolder";

watcher.Filter = "*.txt";

//error here: Cannot implicitly convert type System.EventHandler to

watcher.Created += new System.EventHandler(OnCreated);

watcher.EnableRaisingEvents = true;


private void OnCreated(object sender, System.EventArgs e)




5.Custom event handlers and searching a listview

6. Passing in a OnMouseDown/OnMouseUp event handler as a parameter of a function

7. How to pass more than two parameters in the event handler

8. TADODataset.Parameters.Refresh results in incorrect parameter names

Return to c++ builder


Who is online

Users browsing this forum: No registered users and 99 guest