Does anyone have an example of how wxRibbon should be used with an MDI interface?
I have implemented in wxMDIParentFrame ok and events are passed to the parent event handler ok using an event table. However, some buttons are specific to the wxMDIChildFrame, and with the existing menu/toolbar interface I have these are captured in the child's event table. But for menu bars I explicity initialise the menu for each child:
Code: Select all
subframe = new ChildFrame((wxMDIParentFrame*)m_parent, frame_name);
subframe->SetMenuBar(((MainFrame*)m_parent)->InitMenuBar(frame_name));
Code: Select all
wxBEGIN_EVENT_TABLE(ChildFrame, wxMDIChildFrame)
...
EVT_MENU(MDI_EDIT_DIAGRAM, ChildFrame::OnEditDiagram) /* Works OK for menu events */
EVT_RIBBONBUTTONBAR_CLICKED(MDI_EDIT_DIAGRAM, ChildFrame::OnEditDiagramR) /* Not caught on ribbon click */
...
wxEND_EVENT_TABLE()
ChildFrame::ChildFrame(wxMDIParentFrame* parent, const wxString& title)
: wxMDIChildFrame(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxVSCROLL | wxFULL_REPAINT_ON_RESIZE)
{
...
/* Doesn't work either */
this->Connect(MDI_EDIT_DIAGRAM, wxEVT_COMMAND_RIBBONBUTTON_CLICKED, wxRibbonButtonBarEventHandler(ChildFrame::OnEditDiagramR));
}