Kirix Support Forums

wxAUI_MGR_ALLOW_ACTIVE_PANE

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

wxAUI_MGR_ALLOW_ACTIVE_PANE

Postby Joel on Tue May 23, 2006 7:51 am

Apparently, we have a minor problem:
Image
Even though the main window has lost focus, the sub pane still has the focus state drawn, despite me using wxAUI_MGR_ALLOW_ACTIVE_PANE. I tried fixing it but I just confused myself the more I read the code :oops: What do you think Ben?
Joel's Place
Project Administrator for the UPX GUI and developer for wxDev-C++

I want a legal copy of VS Professional! :P
Joel
Registered User
 
Posts: 37
Joined: Mon Jan 09, 2006 1:32 pm
Location: Singapore

Postby Ben on Tue May 23, 2006 1:47 pm

I believe it to be completely fixable. Right now it's just not implemented. What we'd have to do is intercept the EVT_ACTIVATE or EVT_ACTIVATE_APP and then have that deactivate the pane.

Probably something we should do in the next version.

Thanks for pointing this out.

Best,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

Postby Joel on Wed May 24, 2006 5:39 am

Code: Select all
Index: manager.cpp
===================================================================
--- manager.cpp   (revision 601)
+++ manager.cpp   (working copy)
@@ -552,6 +552,22 @@
     }
}

+static wxPaneInfo* UnsetActivePane(wxPaneInfoArray& panes)
+{
+    int i, pane_count;
+    wxPaneInfo* info = NULL;
+    for (i = 0, pane_count = panes.GetCount(); i < pane_count; ++i)
+    {
+        wxPaneInfo& pane = panes.Item(i);
+        if (pane.state & wxPaneInfo::optionActive)
+        {
+            pane.state &= ~wxPaneInfo::optionActive;
+            info = &pane;
+      }
+    }
+   
+    return info;
+}

// this function is used to sort panes by dock position
static int PaneSortFunc(wxPaneInfo** p1, wxPaneInfo** p2)
@@ -583,6 +599,7 @@
     m_action = actionNone;
     m_last_mouse_move = wxPoint();
     m_hover_button = NULL;
+    m_last_selected = NULL;
     m_art = new wxDefaultDockArt;
     m_hint_wnd = NULL;
     m_flags = flags;
@@ -714,6 +731,8 @@
                 CenterPane().PaneBorder(false));
     }
#endif
+
+    m_frame->Connect(wxEVT_ACTIVATE, (wxObjectEventFunction)(wxActivateEventFunction)&wxFrameManager::OnActivated, NULL, this);
}


@@ -2590,7 +2609,6 @@
     return false;
}

-
void wxFrameManager::OnHintFadeTimer(wxTimerEvent& /*event*/)
{
#ifdef __WXMSW__
@@ -3664,6 +3682,29 @@
     }
}

+void wxFrameManager::OnActivated(wxActivateEvent& event)
+{
+    if (GetFlags() & wxAUI_MGR_ALLOW_ACTIVE_PANE)
+    {
+        if (event.GetActive())
+        {
+            if (m_last_selected)
+            {
+                SetActivePane(m_panes, m_last_selected);
+                m_last_selected = NULL;
+         }
+        }
+        else
+        {
+            wxPaneInfo* info = UnsetActivePane(m_panes);
+            if (info)
+                m_last_selected = info->window;
+        }
+        m_frame->Update();
+        m_frame->Refresh();
+    }
+}
+
void wxFrameManager::OnChildFocus(wxChildFocusEvent& event)
{
     // when a child pane has it's focus set, we should change the
Index: manager.h
===================================================================
--- manager.h   (revision 601)
+++ manager.h   (working copy)
@@ -444,7 +444,8 @@
private:

     // events
-    void OnPaint(wxPaintEvent& event);
+    void OnActivated(wxActivateEvent& event);
+   void OnPaint(wxPaintEvent& event);
     void OnEraseBackground(wxEraseEvent& event);
     void OnSize(wxSizeEvent& event);
     void OnSetCursor(wxSetCursorEvent& event);
@@ -488,6 +489,7 @@
     wxRect m_last_hint;          // last hint rectangle
     wxPoint m_last_mouse_move;   // last mouse move position (see OnMotion)

+    wxWindow* m_last_selected;   // last focussed window before deactivation
     wxWindow* m_hint_wnd;        // transparent hint window (for now, only msw)
     wxTimer m_hint_fadetimer;    // transparent fade timer (for now, only msw)
     int m_hint_fadeamt;          // transparent fade amount (for now, only msw)
That's my patch against my local Subversion copy of wxAUI. Have a look and tell me if its any good.
Joel's Place
Project Administrator for the UPX GUI and developer for wxDev-C++

I want a legal copy of VS Professional! :P
Joel
Registered User
 
Posts: 37
Joined: Mon Jan 09, 2006 1:32 pm
Location: Singapore

Postby Ben on Thu May 25, 2006 4:06 am

Looks very good.

Thanks,
Ben
User avatar
Ben
Kirix Support Team
 
Posts: 522
Joined: Mon Dec 19, 2005 6:29 am

status of patch for activate event handler and active pane

Postby antony on Tue Jan 02, 2007 4:14 pm

I also just encountered this issue, but with the wxWidgets-2.8.0 version of aui.

Looks to me like the above patch to add the activate event handler didn't make it in to 2.8.0. Is there a plan to include this eventually?

Thanks,

-Antony
antony
Registered User
 
Posts: 3
Joined: Fri Jun 09, 2006 6:56 am

Return to wxAUI Questions, Thoughts & Feedback