I started to look on the C::B-Code and want to add a feature.
I just want to add that middle-click on files-tabs close the file, so i made a
m_pNotebook->Connect(wxEVT_MIDDLE_UP, (wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &EditorManager::OnMouseMiddleNotebook);
in the editormanager.cpp and add the OnMouseMiddleNotebook in EditorManager.
Everything was ok, but then i tried to implement the function, with this code
void EditorManager::OnMouseMiddleNotebook(wxMouseEvent& event){
int index;
index = GetNotebook()->HitTest(event.GetPosition());
if(index != wxNOT_FOUND){
QueryClose(GetEditor(index));
}
}
But when i run c::b and click on the file-tab, c::b crash.
I tried some modified code, but it seems, that "HitTest" crash.
I'm using wxWidget 2.6.2, MinGW (ported with c::b) and WinXP.
I'm just started using wxWidgets, is something wrong in my code?
Hope this is the right board to post such a message
See codeblocks.txt for stack dump.
Thx, DaKaLKa
[attachment deleted by admin]
I've changed my code to
void EditorManager::OnMouseMiddleNotebook(wxMouseEvent& event){
int index;
wxPoint pt = event.GetPosition();
Manager::Get()->GetMessageManager()->DebugLog("X : %d Y : %d \n", pt.x,pt.y);
Manager::Get()->GetMessageManager()->DebugLog("Start HitTest!",index);
int pageNr = m_pNotebook->HitTest (pt);
Manager::Get()->GetMessageManager()->DebugLog("HitTest completed!",index);
return;
But it seems, that there is a problem with HitTest, C::B crash just after "Start HitTest!" is printed in debug-log.
Very strange.
Has anybody an idea?
Try this:
void EditorManager::OnMouseMiddleNotebook(wxMouseEvent& event){
int index;
wxPoint pt = event.GetPosition();
Manager::Get()->GetMessageManager()->DebugLog("X : %d Y : %d \n", pt.x,pt.y);
Manager::Get()->GetMessageManager()->DebugLog("Start HitTest!");
int pageNr = m_pNotebook->HitTest (pt);
Manager::Get()->GetMessageManager()->DebugLog("HitTest completed: %d",pageNr);
event.Skip();