I want to just do something simple, override WM_COPY of a TEdit control.
If I try to use the following, you can't change the type in the .dfm or it complains that it doesn't exist so you have to leave it TEdit. But now when saving the .h/.cpp complains about it should be a TEdit when I want it to be TMyEdit.
In MyForm.h:
class TMyEdit : public TEdit
{
private:
virtual void __fastcall WndProc(TMessage &Message);
};
//---------------------------------------------------------------------------
class TMyForm : public TForm
{
// ...
TMyEdit *m_MyEditCtl; // previously TEdit *m_MyEditCtl
// ...
};
In the MyForm.cpp
// ...
void __fastcall TMyEdit::WndProc(TMessage &Message)
{
if (Message.Msg == WM_COPY) {
// I'll handle it ....
}
else {
__super::WndProc(Message);
}
}
// ...
What is the correct way to do this in C++Builder so it works in the form and C++ source files?
TIA!!