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
Solved

How to Override the OnClick event in a new component.

Posted on 2001-08-23
5
822 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

828 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