Question about scrollbars

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
Morat20
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Jan 07, 2014 8:43 pm

Question about scrollbars

Post by Morat20 »

General theory question:

I've been tasked with updating some legacy code. One of the things I want to do is make the frame scrollable. However, I'm stuck on a bit of a problem, in that I can't inherit wxScrolledWindow, because the code in question already uses a custom frame class that extends wxFrame. Written in psuedo-code, what I've got on my hands is

CustomFrame: wxFrame mainFrame

mainFrame has a single, normal, wxPanel mainPanel. In that mainPanel is a single wxNotebook with a bunch of tabs.

So all i want is scrollbars to pop up if I resize the window. Except I can't extend the CustomFrame class to add wxScrolledWindow (the simple solution) without dealing with the usual mess of multiple inheritance problems.

All I want here is a single set of scrollbars, on the main frame that contains the notebook. I know how to code one from scratch, but I'd prefer a solution that doesn't involve massively reworking the main classes of this project.

In specific: the way the whole project is setup is in an Init() function for mainFrame (not in the constructor, that would be logical), first is created the mainPanel, as part of mainFrame, then the wxNotebook (as part of mainPanel). And like I said, I can't extend the mainFrame class to use wxScrolledWindow.
Morat20
Knows some wx things
Knows some wx things
Posts: 41
Joined: Tue Jan 07, 2014 8:43 pm

Re: Question about scrollbars

Post by Morat20 »

Ah, came up with a cheap workaround.

Replaced the mainPanel with a wxScrolledWindow. It scrolls the area that needs it.
Post Reply