Solved

How to Override the OnClick event in a new component.

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

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

689 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