wxRibbonToolbar message issue

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
yves31
In need of some credit
In need of some credit
Posts: 9
Joined: Fri Dec 04, 2015 6:15 pm

wxRibbonToolbar message issue

Post by yves31 » Mon Jun 13, 2016 3:02 am

Hi,
wxRibbonToolbar seems not routing messages the same way as wxToolbar. In the sample of richtext, I placed standard tools such as wxID_FILE_OPEN or wxID_UNDO into a wxRibbonToolbar of wxRibbonbar. When running the app, there is no action after pressing Open button. The wxID_UNDO button did get enabled when undo actions are available, but there is no action either when pressing the Undo button.
To test the issue, I just copied wxRibbonbar related code from ribbon sample to richtext sample. Did I miss anything?
Thanks for any help.


Edit: Found out that message from wxRibbonToobar transmitting wxRibbonToolBarEvent. How to relay to standard wxframe message to get wxID_FILE_OPEN working?

Edit 2: Found a way to make this work, but not sure if it is the best.
1. In event handling
EVT_RIBBONTOOLBAR_CLICKED(wxID_ANY, MainFrame::OnRibbonbarClicked)
2. Implement func
void MainFrame::OnRibbonbarClicked(wxRibbonToolBarEvent& evt)
{
wxCommandEvent evt2(wxEVT_COMMAND_MENU_SELECTED, evt.GetId());
wxPostEvent(this,evt2 );
}

Post Reply