Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/Header Generation    [ Add a report in this area ]  
Report #:  64326   Status: Open
autocreated handler for OnMouseWheel incompatible with signature of TMouseWheelEvent
Project:  C++Builder Build #:  11.0.2902.10471
Version:    11.0 Submitted By:   Sergiy Kanilo
Report Type:  Minor failure / Design problem Date Reported:  7/10/2008 2:05:45 PM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   262052
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 5
It seems that the TMouseWheelEvent accepts const reference to the TPoint, and autogenerated handler uses non-const reference
Somehow it is work if handler set using ObjectInspector, but this is impossible if the component created in run-time.

Possible workaround:
create handler with proper signature and assign it in runtime
Steps to Reproduce:
1. create new form
2. in object explorer add handler for OnMouseWheel
3. add something (comment) in the handler (so it is not removed automatically)
4. add line
  OnMouseWheel =FormMouseWheel;
in the constructor:

#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
__fastcall TForm1::TForm1(TComponent* Owner)

: TForm(Owner)

OnMouseWheel =FormMouseWheel;  // ERROR HERE
void __fastcall TForm1::FormMouseWheel(TObject *Sender, TShiftState Shift,

  int WheelDelta, TPoint &MousePos, bool &Handled)

// ...

5. compile

[BCC32 Error] Unit1.cpp(15): E2034 Cannot convert 'void (_fastcall * (_closure )(TObject *,TShiftState,int,TPoint &,bool &))(TObject *,TShiftState,int,TPoint &,bool &)' to 'TMouseWheelEvent'



Server Response from: ETNACODE01