Solved

How to Override the OnClick event in a new component.

Posted on 2001-08-23
5
832 Views
Last Modified: 2007-12-19
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.
0
Comment
Question by:morees
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6417257
I am not a borland person however what are the access specifiers involved
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 80 total points
ID: 6417310
check parameter. Must be something as TObject *Sender:

void __fastcall TForm1::FormClick(TObject *Sender)
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 6422194
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

0
 
LVL 11

Expert Comment

by:griessh
ID: 6861916
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: http://www.experts-exchange.com/commspt

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6884044
Per recommendation, force-accepted by
Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

734 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