Discussion:
Syntax error
(too old to reply)
Sabetay Toros
2008-03-15 18:11:51 UTC
Permalink
Hi,

I'm trying to set a method FormMouseWheelDown to OnMouseWheel event. The
compiler is giving the following error. I'm using BCB6. What am I doing
wrong?

[C++ Error] ProjeDev.cpp(78): E2034 Cannot convert 'void (_fastcall *
(_closure )(TObject *,TShiftState,TPoint &,bool &))(TObject
*,TShiftState,TPoint &,bool &)' to 'void (_fastcall * (_closure
)(TObject *,TShiftState,const TPoint &,bool &))(TObject
*,TShiftState,const TPoint &,bool &)'


Thanks

Sabeetay

class TFooForm : public TForm {
public :

__fastcall ~TFooForm ();
void __fastcall FormMouseWheelDown(TObject *Sender,
TShiftState Shift, TPoint &MousePos, bool &Handled);


};
//---------------------------------------------------------------------------
__fastcall TFooForm :: TFooForm (TFormFactory * AOwner)
: TForm(Application,0)
{
OnMouseWheelDown = FormMouseWheelDown; // On this line
}
Jason Cipriani
2008-03-15 20:36:22 UTC
Permalink
Post by Sabetay Toros
Hi,
I'm trying to set a method FormMouseWheelDown to OnMouseWheel event. The
compiler is giving the following error. I'm using BCB6. What am I doing
wrong?
[C++ Error] ProjeDev.cpp(78): E2034 Cannot convert 'void (_fastcall *
(_closure )(TObject *,TShiftState,TPoint &,bool &))(TObject
*,TShiftState,TPoint &,bool &)' to 'void (_fastcall * (_closure )(TObject
*,TShiftState,const TPoint &,bool &))(TObject *,TShiftState,const TPoint
&,bool &)'
The key in that error message is the "TPoint &" in the first part and "const
Post by Sabetay Toros
void __fastcall FormMouseWheelDown(TObject *Sender, TShiftState Shift,
TPoint &MousePos, bool &Handled);
The MousePos parameter needs to be a const reference. You need to use:

void __fastcall FormMouseWheelDown(TObject *Sender, TShiftState Shift, const
TPoint &MousePos, bool &Handled);

Jason

Loading...