Page 1 of 1

Problem with Ribbonbar

Posted: Sun Mar 29, 2015 11:09 pm
by Haio
Hello.

I have a question about the wxRibbonbar.

I have a "RibbonButtonBar" with three "RibbonButtons".

For these three "RibbonButtons" I had added the "Ribbonbutton_clicked" events.

I tested the events with a simple test: show a messagebox with different content. "A", "B", "C".

Code: Select all

void amsHauptfenster::OnARibbonbuttonClicked(wxRibbonButtonBarEvent& event)
{
	wxMessageBox( "A", "A" );
}

void amsHauptfenster::OnBRibbonbuttonClicked(wxRibbonButtonBarEvent& event)
{
	wxMessageBox( "B", "B" );
}

void amsHauptfenster::OnCRibbonbuttonClicked(wxRibbonButtonBarEvent& event)
{
	wxMessageBox( "C", "C" );
}
But if I click now on Button "A", I get always the messagebox with "C".
In other words: It doesn't matter which button I click, it always use the last added event --> That is currently the event with "C".
How can I fix that? Or what did I make wrong?

Re: Problem with Ribbonbar

Posted: Sun Mar 29, 2015 11:22 pm
by eranif
Haio wrote:But if I click now on Button "A", I get always the messagebox with "C".
In other words: It doesn't matter which button I click, it always use the last added event --> That is currently the event with "C".
How can I fix that? Or what did I make wrong?
The problem with the wxRibbonButtonBar's button is that they are not a real widgets. i.e. the events are not connected directly to the button
instead, the event is connected to its parent "wxRibbonButtonBar". In such cases, the "Window ID" matters

In your case, I am guessing that all three buttons have "Window ID" of "wxID_ANY" (which means: -1)

To fix this, just type random names, such as:
ID_BUTTON_1, ID_BUTTON_2 and ID_BUTTON_3
wxCrafter will generate enum with these names and the buttons will be identified correctly

Make sure that you have the setting "Generate Window ID" set to "True" (see attached screenshots)
Capture2.PNG
Capture.PNG
NOTE: The same problem exists with normal and wxAUI toolbars: i.e. you need to assign each tool a unique ID

Eran

Re: Problem with Ribbonbar

Posted: Sun Mar 29, 2015 11:55 pm
by Haio
Thank you, eranif. It works great. ;-)

Re: Problem with Ribbonbar

Posted: Wed Apr 01, 2015 4:32 pm
by Haio
Hello.

I have another question/problem with the Ribbonbar.

I added pictures (png files) as icons for my Ribbonbar. The big one for the RibbonbuttonbarButtons works fine.
But the smaller one for the page does not work. It won't be shown.

Image

Re: Problem with Ribbonbar

Posted: Fri Apr 03, 2015 1:48 pm
by eranif
Haio wrote:I have another question/problem with the Ribbonbar.
I suspect that it is not related to wxCrafter. Did you try the wxRibbon demo (that comes with wxWidgets)

Eran