Page 1 of 1

How to disable wxRibbonPage mouse clicking response

Posted: Thu Mar 28, 2019 3:23 am
by shawnee
If I want to disable mouse clicking response on some wxRibbonPage, how to do it?
I used rbpage->Disable(), but this function just disable all of widgets in this page, this page still can be switched. I'm desire that the tab of this ribbon page can not response the clicking.

Thanks!

Re: How to disable wxRibbonPage mouse clicking response

Posted: Thu Mar 28, 2019 1:11 pm
by doublemax
Catch the wxEVT_RIBBONBAR_PAGE_CHANGING event. Use wxRibbonBarEvent::GetPage() to get the page the systems wants to change to. If you want to avoid this, call event.Veto().
https://docs.wxwidgets.org/trunk/classw ... n_bar.html

Re: How to disable wxRibbonPage mouse clicking response

Posted: Fri Mar 29, 2019 1:00 am
by shawnee
doublemax wrote:
Thu Mar 28, 2019 1:11 pm
Catch the wxEVT_RIBBONBAR_PAGE_CHANGING event. Use wxRibbonBarEvent::GetPage() to get the page the systems wants to change to. If you want to avoid this, call event.Veto().
https://docs.wxwidgets.org/trunk/classw ... n_bar.html
Catching wxEVT_RIBBONBAR_PAGE_CHANGING event is more graceful. I used wxEVT_RIBBONBAR_PAGE_CHANGED before.
Thank you, doublemax!

Re: How to disable wxRibbonPage mouse clicking response

Posted: Fri Mar 29, 2019 6:27 am
by shawnee
Hi doublemax,

do you know how to change the text color or text font of ribbon page label ? Thanks!

Re: How to disable wxRibbonPage mouse clicking response

Posted: Fri Mar 29, 2019 8:25 am
by doublemax
shawnee wrote:
Fri Mar 29, 2019 6:27 am
Hi doublemax,

do you know how to change the text color or text font of ribbon page label ? Thanks!

Code: Select all

// wxRibbonBar* m_ribbon;

wxRibbonArtProvider *custom_artprovider = m_ribbon->GetArtProvider()->Clone();

wxFont labelFont( 8, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Lucida Sans Unicode") );
custom_artprovider->SetFont(wxRIBBON_ART_TAB_LABEL_FONT, labelFont );

custom_artprovider->SetColor( wxRIBBON_ART_TAB_LABEL_COLOUR, *wxRED );
m_ribbon->SetArtProvider( custom_artprovider );

Re: How to disable wxRibbonPage mouse clicking response

Posted: Fri Mar 29, 2019 2:30 pm
by ONEEYEMAN
Hi,
Just to clarify:
- all events that ends with "-ed" are NOT vetoable. They are fired when everything is already occurred.
- all event that ends with "-ing" ARE vetoable. They are fired before the thing occurred.

Thank you.

Re: How to disable wxRibbonPage mouse clicking response

Posted: Tue Apr 02, 2019 5:54 am
by shawnee
doublemax wrote:
Fri Mar 29, 2019 8:25 am
shawnee wrote:
Fri Mar 29, 2019 6:27 am
Hi doublemax,

do you know how to change the text color or text font of ribbon page label ? Thanks!

Code: Select all

// wxRibbonBar* m_ribbon;

wxRibbonArtProvider *custom_artprovider = m_ribbon->GetArtProvider()->Clone();

wxFont labelFont( 8, wxFONTFAMILY_ROMAN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxT("Lucida Sans Unicode") );
custom_artprovider->SetFont(wxRIBBON_ART_TAB_LABEL_FONT, labelFont );

custom_artprovider->SetColor( wxRIBBON_ART_TAB_LABEL_COLOUR, *wxRED );
m_ribbon->SetArtProvider( custom_artprovider );
Thanks doublemax!
This way could change text font and color of all of tabs. Is there any way to change one of tab only?

Re: How to disable wxRibbonPage mouse clicking response

Posted: Tue Apr 02, 2019 5:54 am
by shawnee
ONEEYEMAN wrote:
Fri Mar 29, 2019 2:30 pm
Hi,
Just to clarify:
- all events that ends with "-ed" are NOT vetoable. They are fired when everything is already occurred.
- all event that ends with "-ing" ARE vetoable. They are fired before the thing occurred.

Thank you.
Thank you, ONEEYEMAN!

Re: How to disable wxRibbonPage mouse clicking response

Posted: Tue Apr 02, 2019 6:23 am
by doublemax
This way could change text font and color of all of tabs. Is there any way to change one of tab only?
Not easily. You'd have to derive from wxRibbonArtProvider and re-implement wxRibbonArtProvider::DrawTab.