I am converting my project from 6.30 to 6.40 using Visual Studio 2015 Community. Getting a number of compile errors. Most I can figure out but not this one:
error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
It is referring to the END_RESPONSE_TABLE for example:
error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
For 6.40, you get this error when a handler does not have the expected signature. Unfortunately, the error given by the MS compiler is unspecific and just points to the response table as a whole (END_RESPONSE_TABLE). Check the signatures for all the entries in the table.
Some handler signatures have changed for 6.40. You can look up TDispatch in the reference documentation to get it right; e.g. TDispatch<WM_SIZE>. Google works well, e.g. "tdispatch wm_size". The correct signature is given by the second template parameter for the TDispatch::Decode function (e.g. for WM_SIZE it is "void(T::*)(uint, const TSize &)").
Last edit: Vidar Hasfjord 2015-02-27
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
But, when I use a decode function template that is defined within a dispatch template (as you recommended), I got the following error message:
1>...cpp(647): error C2440: 'initializing': cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
1> ...cpp(647): note: None of the functions with this name in scope match the target type
If I make that first function a member of RSClientDialog instead of TDialog, the error goes away. Of course the new CmCancel() function has one line and that line calls TDialog::CmCancel();
Is that what I have to do throughout my project?
Alan
Last edit: Alan Jones 2015-02-28
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Of course, if I had read the documentation more carefully, I would have seen that the functions have to defined in the class. I'm making progress but still have a ways to go.
Alan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Alan, good to hear your port to 6.40 is making progress.
As you found out, 6.40 requires that an event handler is defined in the class that owns the response table in which it is used. This is unfortunate with regard to backwards compatibility, but has some good side-effects; it prevents mistakes, such as forgetting to declare and define a handler, and using a handler in a base by mistake.
Last edit: Vidar Hasfjord 2015-03-02
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2015-05-21
My code looks like as given below:
DEFINE_RESPONSE_TABLE1(PtPartList,FDialog)EV_WM_PAINT,// This is not workingEV_WM_CLOSE// This is workingEV_COMMAND(IDOK,EvSelect),// This is workingEND_RESPONSE_TABLE;
Here FDialog is derived from the TDialog. I am getting the below error for the EV_WM_PAINT only:
error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
Please suggest what to do ?
--Gaurav--
Moderator: Formatted code and error message.
Last edit: Vidar Hasfjord 2015-05-21
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The correct signature for WM_PAINT is "void T::EvPaint()". See TDispatch <WM_PAINT>. Also, for OWLNext 6.40 and later, the handler needs to be defined in PtPartList (i.e. PtPartList::EvPaint), not in a base class. See earlier replies in this discussion thread and the FAQ.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am converting my project from 6.30 to 6.40 using Visual Studio 2015 Community. Getting a number of compile errors. Most I can figure out but not this one:
error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
It is referring to the END_RESPONSE_TABLE for example:
Alan
Moderator: Formatted the code.
Last edit: Vidar Hasfjord 2015-03-02
Hi Alan,
For 6.40, you get this error when a handler does not have the expected signature. Unfortunately, the error given by the MS compiler is unspecific and just points to the response table as a whole (END_RESPONSE_TABLE). Check the signatures for all the entries in the table.
Some handler signatures have changed for 6.40. You can look up TDispatch in the reference documentation to get it right; e.g. TDispatch<WM_SIZE>. Google works well, e.g. "tdispatch wm_size". The correct signature is given by the second template parameter for the TDispatch::Decode function (e.g. for WM_SIZE it is "
void(T::*)(uint, const TSize &)
").Last edit: Vidar Hasfjord 2015-02-27
Also see the FAQ,
> I get response table errors. Has something changed?
It discusses a few other changes that may affect your code.
Hi Vidar,
With moving to OWLNext 6.44, I start to change the Doc/View notification messages, and got the following problem:
For example, I change
vnMarkChanged
notification that should call the following method of the TWindowView derived class:When I use a separate decode function template, as below, it works.
But, when I use a decode function template that is defined within a dispatch template (as you recommended), I got the following error message:
My code looks like this:
What is wrong?
Best,
Ivan Stepanov
Moderator: Formatted code and clarified wording.
Last edit: Vidar Hasfjord 2017-06-30
Hi Ivan,
There is a bug in the documentation. The Decode function template should be
static
:I will fix the documentation. Thanks for the feedback!
Hi Vidar,
thanks for the prompt help.
Thanks for the response but I'm still lost. Here is the signature for the EV_COMMAND. What do I need to add to get my EV_COMMANDs to compile?
Moderator: Formatted the code.
Last edit: Vidar Hasfjord 2015-03-02
I discovered something on this problem by trial and error. In the following:
The signatures for the three functions are:
If I make that first function a member of RSClientDialog instead of TDialog, the error goes away. Of course the new
CmCancel()
function has one line and that line callsTDialog::CmCancel()
;Is that what I have to do throughout my project?
Alan
Last edit: Alan Jones 2015-02-28
Of course, if I had read the documentation more carefully, I would have seen that the functions have to defined in the class. I'm making progress but still have a ways to go.
Alan
Hi Alan, good to hear your port to 6.40 is making progress.
As you found out, 6.40 requires that an event handler is defined in the class that owns the response table in which it is used. This is unfortunate with regard to backwards compatibility, but has some good side-effects; it prevents mistakes, such as forgetting to declare and define a handler, and using a handler in a base by mistake.
Last edit: Vidar Hasfjord 2015-03-02
My code looks like as given below:
Here FDialog is derived from the TDialog. I am getting the below error for the EV_WM_PAINT only:
error C2440: 'initializing' : cannot convert from 'overloaded-function' to 'owl::TDispatchFunction'
Please suggest what to do ?
--Gaurav--
Moderator: Formatted code and error message.
Last edit: Vidar Hasfjord 2015-05-21
Hi Gaurav, welcome to the forum!
The correct signature for WM_PAINT is "void T::EvPaint()". See TDispatch <WM_PAINT>. Also, for OWLNext 6.40 and later, the handler needs to be defined in PtPartList (i.e. PtPartList::EvPaint), not in a base class. See earlier replies in this discussion thread and the FAQ.