Kirix Support Forums

wxAUI - Maximize button bug

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

wxAUI - Maximize button bug

Postby eranif on Tue Apr 03, 2007 10:03 am

Hi,
I reported this in wxWidgets mailing list, but maybe it is a good idea to report it here as well:

I found a little bug in the wxAUI: The MaximizeButton does not always work. For example, in the aui demo that shifts with wxwidgets, if you set MaximizeButton(true) to the bottom pane (the one with the 'Text Pane with hide prompt' capture) you can see that pressing the maximize button will not cause the pane to expand to capture the full screen only, but only half of it.

If you will manually increase the pane size on the 'Y' axis and place it near top, and then press the maximize button, the pane is actually minimized ...

This can easily seen in the auidemo, just change line 855 from:
m_mgr.AddPane(wnd10, wxAuiPaneInfo().
Name(wxT("test10")).Caption
(wxT("Text Pane with Hide Prompt")).
Bottom().Layer(1).Position(1));

to:

m_mgr.AddPane(wnd10, wxAuiPaneInfo().
Name(wxT("test10")).Caption(wxT("Text Pane with Hide Prompt")).
Bottom().Layer(1).Position(1).MaximizeButton());


Thanks,
Eran
eranif
Registered User
 
Posts: 1
Joined: Tue Apr 03, 2007 9:57 am

Postby jonnyO2 on Tue Jun 12, 2007 7:08 pm

I'm experiencing this problem as well!

When I have a window at the bottom of a middle pane, like this:

Code: Select all
-------------
|   |   |   |
|   |   |   |
|   |---|   |
|   |xxx|   |
|   |xxx|   |
-------------


(The x's are the pane in question, there's a full height left pane, a full height right pane and then a middle pane with a top and bottom. I hope the ASCII art makes sense!)

Anyway, when I maximize that middle-bottom pane, it only fills the bottom half of the parent frame.

I'm hoping someonce can help out on this!
jonnyO2
Registered User
 
Posts: 5
Joined: Tue Jun 12, 2007 5:17 pm

Postby Ben on Thu Jun 14, 2007 8:33 am

Hi Jonny,

This is a known bug. It's slated for fixing.

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

Postby jonnyO2 on Thu Jun 14, 2007 10:54 am

Ben,

OK then, I'll leave it up to you then! I started looking at the code and realized I was in over my head...

Thanks,
Jon
jonnyO2
Registered User
 
Posts: 5
Joined: Tue Jun 12, 2007 5:17 pm

Re: wxAUI - Maximize button bug

Postby Tychom on Fri Nov 23, 2007 10:41 am

I'm wondering what the status is with this bug as its started to bite me too leading the maximize button to be of no use currently (quite a pain in this particular app).

This is with 2.8.6 under Win32.

Cheers.
Tychom
Registered User
 
Posts: 1
Joined: Fri Nov 23, 2007 10:34 am

Re: wxAUI - Maximize button bug

Postby Ben on Mon Nov 26, 2007 6:10 am

Hi,

Yes this bug is still open. I was really hoping that the person who implemented the maximize functionality would fix it, but this has not happened. I'll have to try to fix it myself. Sorry this bug is still open in 2.8.6

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

Re: wxAUI - Maximize button bug

Postby NinjaNL on Wed Nov 28, 2007 5:03 am

Just to chip in here.

I also wanted to mention that the bug is present when a Top pane is maximized also.

I know that this probably won't help, and that there is probably some sizer code which once working correctly will cure both symptoms, but I just thought I would highlight this too.

I have looked at the problem myself (and continue to do so without much success) but I admit to being lost in the maze of AUI code.

Is there some sort of design document anywhere which could be made available to interested parties to assist them in their understanding of the code?

Best regards
Mal
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAUI - Maximize button bug

Postby Ben on Wed Nov 28, 2007 2:22 pm

I have looked at the problem myself (and continue to do so without much success) but I admit to being lost in the maze of AUI code.

Is there some sort of design document anywhere which could be made available to interested parties to assist them in their understanding of the code?


I'll be the first to admit that understanding a fresh code base is often difficult, especially because it usually is not entirely clear what the motivations were for various design decisions.

In the case of AUI, we attempted to create a mechanism where the entire state of a frame is saved in a single structure, which can be refreshed at any time to the screen. The problem with predecessor docking toolkits is that often, the state variables and the representation of the gui on screen were mixed. This made it difficult to serialize.

AUI uses sizers to implement the pane layout. All the elements on the screen, including pane captions, sashes, buttons, are sizer elements. Whenever Refresh() is called on the frame manager, these sizers are recreated.

This is neat because, every time the window is resized, the layout is automatically calculated by the sizers. It really saved us from "reinventing the wheel."

The other major design decision in AUI was to put all drawing routines in a separate class, called dock art. This allows users of the library to override how elements are drawn in a modular manner.

I hope you found this information useful.

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

Re: wxAUI - Maximize button bug - solved??? Crappy solution

Postby NinjaNL on Thu Nov 29, 2007 4:14 am

The problem lies within FrameManager.cpp

The pain in the backside line is line number 2233

cont->Add(middle, 1, wxEXPAND);

This should only be added whenever there actually IS content to add to the layout. When the upper or lower panes were maximized there should be no content in the middle sizer, but content is still added.

The solution for me was to introduce a boolean value (since I am not all that at home with sizers) which was set to true only when there was any sort of content being added. I tested the boolean before adding the sizer.

PREVIOUS CODE framemanager.cpp lines 2180 - 2244
Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        cont->Add(middle, 1, wxEXPAND); // THIS IS THE OFFENDING LINE



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }



ABOVE CODE REPLACED BY

Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);
   bool middle_needed = false; //mn see if we have anything in the middle

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {   
                middle_needed = true; //mn adding content so we need a middle sizer
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
   }

        if (middle_needed)     
             cont->Add(middle, 1, wxEXPAND);



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }


I haven't extensively tested this, but it does seem to work.

Best regards
Mal
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAUI - Maximize button bug

Postby tncalucard on Thu Nov 29, 2007 8:04 am

NinjaNL wrote:The problem lies within FrameManager.cpp

The pain in the backside line is line number 2233

cont->Add(middle, 1, wxEXPAND);

This should only be added whenever there actually IS content to add to the layout. When the upper or lower panes were maximized there should be no content in the middle sizer, but content is still added.

The solution for me was to introduce a boolean value (since I am not all that at home with sizers) which was set to true only when there was any sort of content being added. I tested the boolean before adding the sizer.

PREVIOUS CODE framemanager.cpp lines 2180 - 2244
Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        cont->Add(middle, 1, wxEXPAND); // THIS IS THE OFFENDING LINE



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }



ABOVE CODE REPLACED BY

Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);
   bool middle_needed = false; //mn see if we have anything in the middle

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {   
                middle_needed = true; //mn adding content so we need a middle sizer
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
   }

        if (middle_needed)     
             cont->Add(middle, 1, wxEXPAND);



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }


I haven't extensively tested this, but it does seem to work.

Best regards
Mal


I've tried the code that Mal recomended, but I'm still having problems with the button.
Is this code only for docked panes? I'm having problems with floatting panes. My problem
is that some times the pane maximize and others not. If a remove the close button it works
great, but I need that button. And is it normal that the maximize button isn't shown in floating
panes? Do I need to do something so it is shows?

Best regards,

TNC
tncalucard
Registered User
 
Posts: 14
Joined: Mon Oct 08, 2007 9:30 am

Re: wxAUI - Maximize button bug

Postby NinjaNL on Thu Nov 29, 2007 8:40 am

Yeah, this code is meant to fix the problem of a docked pane, I wasn't aware of a problem with floating panes.

Could you provide some code (perhaps a change in the aui demo) which shows the error? I can then replicate it here and see what the problem is.

I am working my way through the bugs reported at sourceforge. If your bug was reported there then I'll eventually get to it.

A warning, I am not that great a programmer, but I intend to solve as many bugs with AUI as I can. I am using it myself in a project, and I need it to work as well as it can

Best
Mal
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAUI - Maximize button bug

Postby tncalucard on Fri Nov 30, 2007 8:39 am

NinjaNL wrote:Yeah, this code is meant to fix the problem of a docked pane, I wasn't aware of a problem with floating panes.

Could you provide some code (perhaps a change in the aui demo) which shows the error? I can then replicate it here and see what the problem is.

I am working my way through the bugs reported at sourceforge. If your bug was reported there then I'll eventually get to it.

A warning, I am not that great a programmer, but I intend to solve as many bugs with AUI as I can. I am using it myself in a project, and I need it to work as well as it can

Best
Mal


I'm using like it:

Code: Select all
frame->auiManager.AddPane(sv,defaultPaneInfo.Caption(_("GWLF Nó ")+node->label->name).Name(s));
frame->auiManager.Update();

Where frame is a wxFrame derived class, auiManager as the name is the manager, sv is a class derived from wxScrolledWindow, defaultPnaeInfo is a variable that I use to pass the pane info and s is a wxString for the name.

deafaultPaneInfo is now like this:
Code: Select all
defaultPaneInfo = (wxAuiPaneInfo().Layer(0).Row(0).FloatingSize(wxSize(800,600)).BestSize(wxSize(800,600)).MinSize(wxSize(400,400))
                     .Floatable(true).LeftDockable(false).TopDockable(true).BottomDockable(true).RightDockable(false).Float()
                     .CaptionVisible(true).CloseButton(true).DestroyOnClose(false).MaximizeButton(true));


When I run some times I can maximize the pane either with the right button of the mouse as with double click of the left button and to restore I can use both as well, but the next time I run it it doesn't work. This problems is passed to the executable file.

If a click with the right mouse button, with the pane not maximized, it shows restore button enabled and maximized button disabled.

As I tested in other program I noticed that if the pane is born floating the problem happens but if it is born docked an the the user puts it to float it seens to not happen.

The code of the other program is as fallows:

Code: Select all
m_mgr.AddPane(text1,wxAuiPaneInfo().MaximizeButton(true).
                  Name(_("text1")).Caption(_("Text Pane")).
                  Float().Layer(1));
m_mgr.AddPane(text2,wxAuiPaneInfo().MaximizeButton(true).
                  Name(_("text2")).Caption(_("Text Pane")).
              Left().Layer(0).DestroyOnClose(false));
m_mgr.Update();


m_mgr for the manager and this code was introduced in a wxFrame derived class.
The pane text2 worked fine but the text1 some times works and others not.

Thanks,
TNC
tncalucard
Registered User
 
Posts: 14
Joined: Mon Oct 08, 2007 9:30 am

Re: wxAUI - Maximize button bug

Postby NinjaNL on Fri Nov 30, 2007 12:49 pm

tncalucard wrote:And is it normal that the maximize button isn't shown in floating
panes? Do I need to do something so it is shows?


I've been busy with this on the wx-users list, and apparently when wxMiniFrame is used as the base class for the floating panes, then there is no possibility to have the maximize and minimize buttons on the frame. (I believe that the documentation for wxMiniFrame is therefore in serious need of an overhaul).

HOWEVER if you desperately need these buttons then you can simply change the lines from line number 25 in floatpane.h from

Code: Select all
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) ||  defined( __WXGTK__ )
#include "wx/minifram.h"
#define wxAuiFloatingFrameBaseClass wxMiniFrame
#else
#define wxAuiFloatingFrameBaseClass wxFrame
#endif

to

Code: Select all
#define wxAuiFloatingFrameBaseClass wxFrame


The floating panes will then get the standard frame caption, complete with possibility for the maximize, minimize and close buttons.

Best
Mal
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAUI - Maximize button bug - solved??? Crappy solution

Postby dazz on Wed Dec 19, 2007 1:11 am

Hi Mal,

Can you make whatever is needed available to implement this fix? (I don't have FrameManager.cpp etc)

thx


NinjaNL wrote:The problem lies within FrameManager.cpp

The pain in the backside line is line number 2233

cont->Add(middle, 1, wxEXPAND);

This should only be added whenever there actually IS content to add to the layout. When the upper or lower panes were maximized there should be no content in the middle sizer, but content is still added.

The solution for me was to introduce a boolean value (since I am not all that at home with sizers) which was set to true only when there was any sort of content being added. I tested the boolean before adding the sizer.

PREVIOUS CODE framemanager.cpp lines 2180 - 2244
Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        cont->Add(middle, 1, wxEXPAND); // THIS IS THE OFFENDING LINE



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }



ABOVE CODE REPLACED BY

Code: Select all
        // fill out the middle layer (which consists
        // of left docks, content area and right docks)

        middle = new wxBoxSizer(wxHORIZONTAL);
   bool middle_needed = false; //mn see if we have anything in the middle

        // find any left docks in this layer
        FindDocks(docks, wxAUI_DOCK_LEFT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = 0, row_count = arr.GetCount(); row < row_count; ++row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
        }

        // add content dock (or previous layer's sizer
        // to the middle
        if (!old_cont)
        {
            // find any center docks
            FindDocks(docks, wxAUI_DOCK_CENTER, -1, -1, arr);
            if (!arr.IsEmpty())
            {   
                middle_needed = true; //mn adding content so we need a middle sizer
                for (row = 0,row_count = arr.GetCount(); row<row_count; ++row)
                   LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
            }
            else if (!m_has_maximized)
            {
                // there are no center docks, add a background area
                wxSizerItem* sizer_item = middle->Add(1,1, 1, wxEXPAND);
                wxAuiDockUIPart part;
                part.type = wxAuiDockUIPart::typeBackground;
                part.pane = NULL;
                part.dock = NULL;
                part.button = NULL;
                part.cont_sizer = middle;
                part.sizer_item = sizer_item;
                uiparts.Add(part);
            }
        }
        else
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            middle->Add(old_cont, 1, wxEXPAND);
        }

        // find any right docks in this layer
        FindDocks(docks, wxAUI_DOCK_RIGHT, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {   
            middle_needed = true; //mn adding content so we need a middle sizer
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(middle, *arr.Item(row), uiparts, spacer_only);
   }

        if (middle_needed)     
             cont->Add(middle, 1, wxEXPAND);



        // find any bottom docks in this layer
        FindDocks(docks, wxAUI_DOCK_BOTTOM, layer, -1, arr);
        RenumberDockRows(arr);
        if (!arr.IsEmpty())
        {
            for (row = arr.GetCount()-1; row >= 0; --row)
                LayoutAddDock(cont, *arr.Item(row), uiparts, spacer_only);
        }


I haven't extensively tested this, but it does seem to work.

Best regards
Mal
dazz
Registered User
 
Posts: 1
Joined: Wed Dec 19, 2007 1:07 am

Re: wxAUI - Maximize button bug - solved??? Crappy solution

Postby NinjaNL on Wed Dec 19, 2007 8:21 am

dazz wrote:Hi Mal,

Can you make whatever is needed available to implement this fix? (I don't have FrameManager.cpp etc)

thx



Could I ask how (and what version it is) you managed to get the libraries then?

Best
Mal
NinjaNL
Registered User
 
Posts: 40
Joined: Thu Jun 14, 2007 6:53 am

Re: wxAUI - Maximize button bug

Postby tncalucard on Wed Dec 26, 2007 7:59 am

tncalucard wrote:
I'm using like it:

Code: Select all
frame->auiManager.AddPane(sv,defaultPaneInfo.Caption(_("GWLF Nó ")+node->label->name).Name(s));
frame->auiManager.Update();

Where frame is a wxFrame derived class, auiManager as the name is the manager, sv is a class derived from wxScrolledWindow, defaultPnaeInfo is a variable that I use to pass the pane info and s is a wxString for the name.

deafaultPaneInfo is now like this:
Code: Select all
defaultPaneInfo = (wxAuiPaneInfo().Layer(0).Row(0).FloatingSize(wxSize(800,600)).BestSize(wxSize(800,600)).MinSize(wxSize(400,400))
                     .Floatable(true).LeftDockable(false).TopDockable(true).BottomDockable(true).RightDockable(false).Float()
                     .CaptionVisible(true).CloseButton(true).DestroyOnClose(false).MaximizeButton(true));


When I run some times I can maximize the pane either with the right button of the mouse as with double click of the left button and to restore I can use both as well, but the next time I run it it doesn't work. This problems is passed to the executable file.

If a click with the right mouse button, with the pane not maximized, it shows restore button enabled and maximized button disabled.

As I tested in other program I noticed that if the pane is born floating the problem happens but if it is born docked an the the user puts it to float it seens to not happen.

The code of the other program is as fallows:

Code: Select all
m_mgr.AddPane(text1,wxAuiPaneInfo().MaximizeButton(true).
                  Name(_("text1")).Caption(_("Text Pane")).
                  Float().Layer(1));
m_mgr.AddPane(text2,wxAuiPaneInfo().MaximizeButton(true).
                  Name(_("text2")).Caption(_("Text Pane")).
              Left().Layer(0).DestroyOnClose(false));
m_mgr.Update();


m_mgr for the manager and this code was introduced in a wxFrame derived class.
The pane text2 worked fine but the text1 some times works and others not.

Thanks,
TNC


Can anybody help me, I haven't managed to fix this problem.
The problem always occurs with wxMiniFrame or when I use the style wxFRAME_TOOL_WINDOW from wxFrame.

If I don't use the wxFRAME_TOOL_WINDOW style and try to restore a minimized window the only thing that restores is the floating pane or it doesn't restore at all.

Thanks,
TNC
tncalucard
Registered User
 
Posts: 14
Joined: Mon Oct 08, 2007 9:30 am

Re: wxAUI - Maximize button bug

Postby kucalaba on Mon Apr 28, 2008 4:27 pm

FYI, your solution for the AUI maximize pane bug works, but it leaks memory. The "middle" sizer needs to be deleted in the case that it is not added to the container.

if (middle_needed)
cont->Add(middle, 1, wxEXPAND);
+ else
+ delete(middle);

Luke
kucalaba
Registered User
 
Posts: 1
Joined: Mon Apr 28, 2008 4:24 pm

Re: wxAUI - Maximize button bug

Postby Ben on Sat May 24, 2008 10:08 am

kucalaba wrote:FYI, your solution for the AUI maximize pane bug works, but it leaks memory. The "middle" sizer needs to be deleted in the case that it is not added to the container.

if (middle_needed)
cont->Add(middle, 1, wxEXPAND);
+ else
+ delete(middle);

Luke



Indeed. Thanks for the tip. I'll patch it.

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

Return to wxAUI Questions, Thoughts & Feedback