How to disable wxRibbonPage mouse clicking response

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
shawnee
Experienced Solver
Experienced Solver
Posts: 62
Joined: Tue Jan 16, 2018 1:05 am

How to disable wxRibbonPage mouse clicking response

Post by shawnee » Thu Mar 28, 2019 3:23 am

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!

User avatar
doublemax
Moderator
Moderator
Posts: 14518
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to disable wxRibbonPage mouse clicking response

Post by doublemax » 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
Use the source, Luke!

shawnee
Experienced Solver
Experienced Solver
Posts: 62
Joined: Tue Jan 16, 2018 1:05 am

Re: How to disable wxRibbonPage mouse clicking response

Post by shawnee » Fri Mar 29, 2019 1:00 am

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!

shawnee
Experienced Solver
Experienced Solver
Posts: 62
Joined: Tue Jan 16, 2018 1:05 am

Re: How to disable wxRibbonPage mouse clicking response

Post by shawnee » 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!

User avatar
doublemax
Moderator
Moderator
Posts: 14518
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to disable wxRibbonPage mouse clicking response

Post by doublemax » 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 );
Use the source, Luke!

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3799
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: How to disable wxRibbonPage mouse clicking response

Post by ONEEYEMAN » 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.

shawnee
Experienced Solver
Experienced Solver
Posts: 62
Joined: Tue Jan 16, 2018 1:05 am

Re: How to disable wxRibbonPage mouse clicking response

Post by shawnee » Tue Apr 02, 2019 5:54 am

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?

shawnee
Experienced Solver
Experienced Solver
Posts: 62
Joined: Tue Jan 16, 2018 1:05 am

Re: How to disable wxRibbonPage mouse clicking response

Post by shawnee » Tue Apr 02, 2019 5:54 am

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!

User avatar
doublemax
Moderator
Moderator
Posts: 14518
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to disable wxRibbonPage mouse clicking response

Post by doublemax » Tue Apr 02, 2019 6:23 am

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.
Use the source, Luke!

Post Reply