Link to home
Start Free TrialLog in
Avatar of morees
morees

asked on

How to Override the OnClick event in a new component.

I'm writing a new component in C++ Builder v5.0 but I get the following error when I try to compile the unit,

(C++ Error) myedit.h(42)E2113 Virtual Function '__fastcall TMyEdit::Click()' conflicts with base class TControl.

This is the *.h file

//---------------------------------------------------------#ifndef MyEditH
#define MyEditH
//---------------------------------------------------------#include <SysUtils.hpp>
#include <Controls.hpp>
#include <Classes.hpp>
#include <Forms.hpp>
#include <StdCtrls.hpp>
//---------------------------------------------------------class PACKAGE TMyEdit : public TCustomEdit
{
private:
   TNotifyEvent FOnEnter;
protected:
 
   ************* This where I get the error ************
   void __fastcall DoEnter(void);
   *****************************************************
   __property TNotifyEvent OnEnter = {read=FOnEnter, write=FOnEnter};
public:
__fastcall TMyEdit(TComponent* Owner);
__published:
};
//---------------------------------------------------------#endif


Please give me an example of how to override the OnClick method.

Thanks.
Avatar of ShaunWilde
ShaunWilde

I am not a borland person however what are the access specifiers involved
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And usually use
  Classes::TNotifyEvent OnEnter
....
  __property Classes::TNotifyEvent OnEnter = {read=FOnEnter, write=FOnEnter};
...
And seems me you have error
TNotifyEvent FOnEnter; //must be OnEnter

I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity,  I will suggest to accept "AlexVirchovski" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: https://www.experts-exchange.com/commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Per recommendation, force-accepted by
Netminder
Community Support Moderator
Experts Exchange