"Active" and "Selected" wxAuiMDIChildFrame inconsistency

38 views
Skip to first unread message

wsu

unread,
Aug 28, 2012, 11:08:09 PM8/28/12
to wx-...@googlegroups.com

Suppose a wxAuiMDIParentFrame has a wxAuiMDIChildFrame.  If a second wxAuiMDIChildFrame is allocated, and Show(false) is called before Create(), then wxAuiMDIParentFrame has SetActiveChild() called for the second wxAuiMDIChildFrame, but the wxAuiMDIClientWindow::InsertPage() does not call wxAuiMDIChildFrame SetSelectionToWindow() for the second wxAuiMDIChildFrame.  This results in the wxAuiMDIParentFrame treating the second wxAuiMDIChildFrame as active, but the wxAuiMDIClientWindow treating the first wxAuiMDIChildFrame as selected.

It would be easy to modify wxAuiMDIParentFrame::SetActiveChild() so that when Show(false) has been called, it skips SetActiveChild() so that the program is in a consistent state with the first wxAuiMDIChildFrame both active and selected.  However, I am not convinced that is the right thing to do.  I think the wxAuiMDIParentFrame should be modified so that SetActiveChild() and GetActiveChild() are convenience functions wrapping the wxAuiMDIClientWindow SetSelection() and GetSelection().  This would prevent any other situation where the active and selected children are different.  Is there a reason there are separate active and selected concepts?

wsu

unread,
Sep 13, 2012, 9:51:35 PM9/13/12
to wx-...@googlegroups.com
No one responded to this, so I will try again:  Can anyone explain the difference between the wxAuiMDI active and selected wxAuiMDIChildFrames?

Vadim Zeitlin

unread,
Sep 14, 2012, 6:18:29 AM9/14/12
to wx-...@googlegroups.com
On Thu, 13 Sep 2012 18:51:35 -0700 (PDT) wsu wrote:

w> No one responded to this, so I will try again: Can anyone explain the
w> difference between the wxAuiMDI active and selected wxAuiMDIChildFrames?

I didn't answer the original email because I simply had no idea about this
and hoped someone else would. Apparently no one else does though so you're
probably the foremost expert on this question yourself and I'd just apply
any changes you propose, especially if their (beneficial) effect can be
seen in the aui sample.

FWIW wxMDIParentFrame has the concept of "active" child only, so I think
"selected" is just wxAuiMDI implementation detail which is leaking through.
I.e. I agree that the best would be to ensure that setting the active child
changes the selection and querying the active child returns the currently
selected one.

Regards,
VZ

wsu

unread,
Sep 14, 2012, 11:44:53 PM9/14/12
to wx-...@googlegroups.com
Unfortunately, none of the samples demonstrates wxAuiMDI, and the problem I am seeing is there, not in wxAui.
 
I will test whether treating active as selected seems reasonable, and provide a patch if I like the results.
Reply all
Reply to author
Forward
0 new messages