Solved

How to Override the OnClick event in a new component.

Posted on 2001-08-23
5
809 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
5 Comments
 
LVL 9

Expert Comment

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

Accepted Solution

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

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

Expert Comment

by:AlexVirochovsky
Comment Utility
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
Comment Utility
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
Comment Utility
Per recommendation, force-accepted by
Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

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

Join & Write a Comment

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

772 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

11 Experts available now in Live!

Get 1:1 Help Now