void __fastcall TForm3::FormCreate(TObject *Sender)
{
this->DBGridEh1->OnCellMouseClick = myDBGridEh1CellMouseClick;
}
void __fastcall TForm3::myDBGridEh1CellMouseClick(TCustomGridEh *Grid, Gridseh::TGridCoord &Cell,
TMouseButton Button, TShiftState Shift, int X, int Y, bool &Processed)
{
;
}
[bcc32 Error] Unit3.cpp(72): E2034 Cannot convert 'void (_fastcall * (_closure )(TCustomGridEh *,TGridCoord &,TMouseButton,TShiftState,int,int,bool &))(TCustomGridEh *,TGridCoord &,TMouseButton,TShiftState,int,int,bool &)' to 'TGridEhCellMouseEvent'
Full parser context
Unit3.cpp(70): parsing: void _fastcall TForm3::FormCreate(TObject *)
查看定义
C:\Users\Public\Documents\RAD Studio\12.0\hpp\GridsEh.hpp
__property OnCellMouseClick;
__property Gridseh::TGridEhCellMouseEvent OnCellMouseClick = {read=FOnCellMouseClick, write=FOnCellMouseClick};
typedef void __fastcall (__closure *TGridEhCellMouseEvent)(TCustomGridEh* Grid, const TGridCoord &Cell, System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y, bool &Processed);
看出区别在与头文件里的原始定义有const 修饰符,但是新的定义里没有加上就可以了
void __fastcall TForm3::myDBGridEh1CellMouseClick(TCustomGridEh *Grid, const Gridseh::TGridCoord &Cell,
TMouseButton Button, TShiftState Shift, int X, int Y, bool &Processed)
{
;
}