Menu

Response table window messages no compiling in OWLNEXT 7

2022-07-21
2022-07-21
  • Martin Cohen

    Martin Cohen - 2022-07-21

    I am migrating my application from OWLNEXT 6.32.5 to OWLNEXT 7. I now have a LOT of compile errors where I previously had none! I guess I need to work through them one at a time....Here's the first one:

    I have a response table in a Class derived from TFrameWindow. It looks like this :

    DEFINE_RESPONSE_TABLE1(HorizonPlotWindow,TFrameWindow)
      EV_WM_LBUTTONDOWN,
      EV_WM_LBUTTONUP,
      EV_WM_MOUSEMOVE,
      EV_WM_RBUTTONDOWN,
    END_RESPONSE_TABLE;
    

    The compiler doesn't like any of the four EV_WM_XXXXXXX lines. here is the error message I get for the first one:

    error C2664: 'bool owl::CheckSignature<HorizonPlotWindow::TMyClass,513,owl::TDispatch>(void (__thiscall HorizonPlotWindow::* )(owl::uint,const owl::TPoint &)) noexcept':
    cannot convert argument 1 from
    'void (__thiscall HorizonPlotWindow::* )(UINT,owl::TPoint &)' to 
    'void (__thiscall HorizonPlotWindow::* )(owl::uint,const owl::TPoint &)'
    

    Any help appreciated!


    Moderator: Formatted post.

     

    Last edit: Vidar Hasfjord 2022-07-21
  • Vidar Hasfjord

    Vidar Hasfjord - 2022-07-21

    See Upgrading from OWL | Message dispatch overhaul and FAQ.

    cannot convert argument 1 from 'void (__thiscall HorizonPlotWindow:: )(UINT, owl::TPoint &)' to 'void (__thiscall HorizonPlotWindow::* )(owl::uint, const owl::TPoint &)

    Note the differences highlighted by me in bold. Event handler signatures are now const-correct.

     
  • Martin Cohen

    Martin Cohen - 2022-07-21

    Forgive my ignorance, but I don't understand what you are saying. I can see the difference, but how do I fix this? It used to compile fine.

    My handler declaration looks like this:

    void EvLButtonDown(UINT modKeys, TPoint& point);

    Should I change it somehow?


    Moderator: Consolidated and formatted post.

     

    Last edit: Vidar Hasfjord 2022-07-21
  • Vidar Hasfjord

    Vidar Hasfjord - 2022-07-21

    You need to add "const" to the last parameter in your event handler, as follows:

    void HorizonPlotWindow::EvLButtonDown(uint modKeys, const TPoint& point)

    The following FAQ entry explains the const-correctness issue:

    FAQ | Why is everything now const, and how can I be const-correct?

     

    Last edit: Vidar Hasfjord 2022-07-21
  • Martin Cohen

    Martin Cohen - 2022-07-21

    OK, that fixes most of them, many thanks....but the EV_WM_PAINT isn't happy. I changed it from

    void Paint(TDC& dc, bool erase, TRect& clip);

    to

    void Paint(TDC& dc, bool erase, const TRect& clip);

    but it still doesn't like it.


    Moderator: Formatted post.

     

    Last edit: Vidar Hasfjord 2022-07-21
  • Vidar Hasfjord

    Vidar Hasfjord - 2022-07-21

    void Paint(TDC& dc, bool erase, TRect& clip);

    This is the virtual function called by EvPaint, and its signature should not be changed (it is still not const-correct due to compatibility issues). EvPaint is the event handler for WM_PAINT, and as you can see in the link provided, it has no parameters.

    You can look up correct signatures for event handlers in the OWLNext API Documentation.

     

    Last edit: Vidar Hasfjord 2022-07-21
  • Martin Cohen

    Martin Cohen - 2022-07-21

    OK, thank you!

     
    👍
    1

Anonymous
Anonymous

Add attachments
Cancel