Ribbonbar (even though collapsed) becomes expanded when it repaints
|Reported by:||snowleopard2||Owned by:|
|Keywords:||ribbonbar ribbon||Cc:||rakeshthp, wxBen|
Run the Ribbon example and either double click a tab on it or click the toggle button in the right corner, this will make the ribbon collapse. Now, either click in the text area in the program or give another program the focus and go back to the ribbon demo--note how the ribbon is now expanded again. Basically, when you collapse the ribbon, anything that triggers a paint event will make it expanded again.
Digging through the code, I think a call to HideIfExpanded() from OnKillFocus() is the culprit. When the demo loses the focus and my ribbon is collapsed, I step into this function and "m_ribbon_state" is set to "wxRIBBON_BAR_MINIMIZED"--which makes sense. However, in this function it expects "m_ribbon_state == wxRIBBON_BAR_EXPANDED", otherwise it will set it to "wxRIBBON_BAR_PINNED" and then it gets expanded because of that later. If I had to guess, the first line of HideIfExpanded() should be this:
m_ribbon_state == wxRIBBON_BAR_MINIMIZED || m_ribbon_state == wxRIBBON_BAR_EXPANDED
and NOT this:
m_ribbon_state == wxRIBBON_BAR_EXPANDED
but I'm not 100% on what the intention is in this function--the ribbon bar is supposed to hide itself when it loses the focus? At any rate, this seems wrong, because it's really annoying how it keeps expanding itself whenever I click in the program's client area or switch between programs.
This worked OK in 2.9.4 (there you could double click the tab to hide it), this seems to be a new problem in 2.9.5. Thanks.