Kirix Support Forums

[SOLVED]Using wxEVT_COMMAND_AUINOTEBOOK_

Please post all general questions, comments, bug reports, and any other wxAUI feedback here.

[SOLVED]Using wxEVT_COMMAND_AUINOTEBOOK_

Postby mikael.delsol on Fri Mar 02, 2007 11:43 am

Hello,
I read most of the topics concerning the wxAuiNotebook and what people want to do with this.
Actually, I would like to do the thing asked at the topic "wxAuiNotebook "OnTabDragMotion" and "OnTabEndDrag" to change their behaviour but I have a first problem which is that I can't override these methods.

Actually, I have an error which is :
"error C2440: 'static_cast' : impossible de convertir de 'void (__thiscall notebook::* )(wxAuiNotebookEvent)' en 'wxCommandEventFunction'"


The methods are declared in my class "notebook" derived from "wxAuiNotebook" like this :
Code: Select all
    void OnTabEndDrag(wxAuiNotebookEvent evt);
    void OnTabDragMotion(wxAuiNotebookEvent evt);


This is how I declare the methods launched by the event :
Code: Select all
BEGIN_EVENT_TABLE(notebook,wxAuiNotebook)
    EVT_COMMAND_RANGE(id_notebook, id_notebook+500,
                      wxEVT_COMMAND_AUINOTEBOOK_END_DRAG,
                      notebook::OnTabEndDrag)
    EVT_COMMAND_RANGE(id_notebook,id_notebook+500,
                      wxEVT_COMMAND_AUINOTEBOOK_DRAG_MOTION,
                      notebook::OnTabDragMotion)
END_EVENT_TABLE()

I paste the same scheme than as in "auibook.cpp".

Can you help me to solve my problem?

Thanks a lot
Best regards
mikael.delsol
Registered User
 
Posts: 13
Joined: Fri Mar 02, 2007 11:22 am
Location: Montpellier, France

Postby Ben on Thu Mar 08, 2007 5:56 am

Hello,

Your problem is that you forgot a "&"

Code: Select all
    void OnTabEndDrag(wxAuiNotebookEvent evt);
    void OnTabDragMotion(wxAuiNotebookEvent evt);


should be

Code: Select all
    void OnTabEndDrag(wxAuiNotebookEvent& evt);
    void OnTabDragMotion(wxAuiNotebookEvent& evt);


All the best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 525
Joined: Mon Dec 19, 2005 6:29 am

Return to wxAUI Questions, Thoughts & Feedback