wxRibbonPage removing and inserting.

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.
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

wxRibbonPage removing and inserting.

Post by Cursor »

Hi all.

Is any way to remove existing wxRibbonPage on a wxRibbonBar ? I have not found any function for this.

Generally, is a way to insert or remove wxRibbonCtrls to their parents in homogeneous API like wxBookCtrlBase ?

If not at present time, is it expected ?

Thanks. Regards.
Emilien
What is little and green, witch go up and down ??
Yoda playing with the force.
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

I shall need this soon as well, I do see in bar.cpp:

page->Hide();

And in the header file page.h:

virtual bool Show(bool show = true);
rakeshthp
I live to help wx-kind
I live to help wx-kind
Posts: 154
Joined: Mon Apr 06, 2009 10:02 am
Location: India

Re: wxRibbonPage removing and inserting.

Post by rakeshthp »

Hi,

I was also looking for the same. But the latest snapshot of the nightly build does has function DeletePage(). I haven't tested it yet, as I am not sure whether the function is fully functional or not. I guess it is fully functional because, the function call is done in sample/ribbon code too.

http://trac.wxwidgets.org/changeset/71888

Good luck.

Regards
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Re: wxRibbonPage removing and inserting.

Post by Cursor »

This is functional but not deeply tested on a wide range of platform.
I will work soon on two other patches : show/hide pages and inserting pages at a dedicated index (rather than adding them at end).

I dont know if the inserting functionnality is really usefull if the API allow to hide pages. Comments about that are welcome.
What is little and green, witch go up and down ??
Yoda playing with the force.
rakeshthp
I live to help wx-kind
I live to help wx-kind
Posts: 154
Joined: Mon Apr 06, 2009 10:02 am
Location: India

Re: wxRibbonPage removing and inserting.

Post by rakeshthp »

Hi Cursor,

I had tried with hiding page. May be I haven't understood the proper functionality. When I call this function,

Code: Select all

page->Hide();
Only the page (all the panels and controls on that panel) gets hidden. But the tab on top remains as it is. Hopefully some work may be still going on over it. Actually a similar test must be done on tabbed note book and see how the Hide() behaves there.

Regards
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

What I would like is to be able to add pages, and then dynamics show or hide their tabs in the view (while still keeping the pages as is). This is very commonly done in many ribbon bar type applications.

I have been looking at the code and I think the changes are relatively easy to make. I updated my own code from the main trunk via svn just now and will make the additions. Within a couple of days a patch will be available.

I need this functionality for a software project, it is a must have, so I shall add it myself then and make available to anyone else.
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

I have added the changes I needed to the latest trunk version. Once I have tested it a little more, I shall send in a patch for consideration. The changes are:

bar.h, bar.cpp added these methods to wxRibbonBar:

int GetPageNumber(wxRibbonPage* page);
bool GetShowTab(size_t page);
void SetShowTab(size_t page, bool show_tab);

After showing or hiding a tab, you need to call wxRibbonBar::Realize().

In my application the changes I made work fine. I can initially build all the pages and then hide or show the tabs at runtime as things change. Anyone is welcome to test this code and send me feedback before I send the patch in. The files are:

wxWidgets\include\wx\ribbon\bar.h
wxWidgets\src\ribbon\bar.cpp
Attachments
RibbonBarShowTab.zip
bar.h and bar.cpp
(8.33 KiB) Downloaded 174 times
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Re: wxRibbonPage removing and inserting.

Post by Cursor »

I understahnd your needs, I need such "show/hide pages" functionnalities too. I have coded a patch about that but a bug in MSW art provider persists. I will look at your code too.
BR
What is little and green, witch go up and down ??
Yoda playing with the force.
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

I have submitted a patch with the functionality described in my earlier post:

http://trac.wxwidgets.org/ticket/14471
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

It looks like some proposed patches sit there for months and months... lets hope this one is considered safe and can just go in smoothly.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxRibbonPage removing and inserting.

Post by doublemax »

Vadim just went on vacation and as he's pretty much the only one doing this kind of work, delays are to be expected.
Use the source, Luke!
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

I have uploaded a new patch to ticket 14471, implementing some suggestions from vadz (renamed the methods, added sample code, fixed documentation glitch).
Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Re: wxRibbonPage removing and inserting.

Post by Cursor »

Cool. Good job. Thanks
What is little and green, witch go up and down ??
Yoda playing with the force.
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

Awesome, thank you. Vadz has integrated the patch on main.
wxBen
Experienced Solver
Experienced Solver
Posts: 64
Joined: Wed Jun 06, 2012 4:44 pm
Location: Calgary, Canada

Re: wxRibbonPage removing and inserting.

Post by wxBen »

On the topic of the ribbon bar (and so I can find it more easily to trac it), I also submitted a patch which adds a disabled label color to the ribbon bar. See here:

http://trac.wxwidgets.org/ticket/14522
Post Reply