Can't get wxScrolledWindow to show scrollbars on Mac OS X. Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Can't get wxScrolledWindow to show scrollbars on Mac OS X.

Post by Jasper » Thu Jul 28, 2005 9:53 am

I'm porting an application from Windows to Mac OS X. Since I used wxWidgets this has been a reasonably painless experience (apart from some cosmetic problems and occasional breakage due to use of undefined behaviour).

There is however one problem that doesn't seem to want to go away. For some reason I can't get my wxScrolledWindow to have any scrollbars, at all. I've double-checked the window styles, tried several ways of setting up scrolling and still haven't seen a single scrollbar. I do have scrollbars on a wxHtmlControl and a wxListView window.

I'm using wxMac 2.6.1 on Mac OS X 10.3.9, built using the xcode project file (as far as I can remember I just used the default settings).

I'm interested in any suggestions to help solve this problem or further pin it down.

KevinHock
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Sat Sep 04, 2004 1:49 pm
Location: Ohio, USA
Contact:

Post by KevinHock » Fri Jul 29, 2005 2:26 pm

Strange, because I used a wxScrolledWindow with no problems on Mac OS X. How are you trying to show the scrollbars? I just use SetVirtualSize to say how big I'd like the canvas to be, and the scrollbars automagically work. :)

Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Post by Jasper » Fri Jul 29, 2005 3:25 pm

That's what I'm doing, and I've also tried SetScrollBars, both don't work for me (and it does work on Win32 btw). I'm currently calling the following:

Code: Select all

  SetVirtualSize(width_p, height_p);
  SetScrollRate(5,5);
Are there any relevant defines?

KevinHock
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Sat Sep 04, 2004 1:49 pm
Location: Ohio, USA
Contact:

Post by KevinHock » Fri Jul 29, 2005 4:33 pm

Just for kicks, have you tried forcing the window to redrawn after calling SetVirtualSize? Also, if you resize it do the scrollbars appear?

I guess I'm a bit baffled since it's always worked so easily for me, and all I do is use SetVirtualSize, just like you show. BTW, I assume your virtual size is larger than your window size, right?

Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Post by Jasper » Sat Jul 30, 2005 8:15 am

Refreshing and/or resizing didn't help (and the virtual size was bigger than the window size), but I think I may have figured out what triggers the problem. The scrolled window(s) are children of a wxNotebook (I also tried wxListbook btw, with the same result), but when I create a scrolled window using the exact same class directly on the main window (a wxPanel inside a wxFrame), then it works perfectly. Any ideas on how to solve this?

KevinHock
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Sat Sep 04, 2004 1:49 pm
Location: Ohio, USA
Contact:

Post by KevinHock » Sat Jul 30, 2005 2:20 pm

I have two theories:

1) The notebook is expanding to the virtual size (which seems unlikely)

or

2) the scrollbars are being drawn past the edge of the notebook?

Or, maybe it's possible on Mac OS X that you can't have a scrolled window inside a notebook? That would be unfortunate and I don't know the answer to that one...

Jasper
Earned a small fee
Earned a small fee
Posts: 18
Joined: Tue Sep 21, 2004 1:49 pm
Contact:

Post by Jasper » Sun Jul 31, 2005 11:26 am

I just found that it doesn't work on Win32 too in fact, sorry for the confusion. I didn't notice this earlier because until very recently I still used wxWidgets 2.4.2 on Win32, while I used wxWidgets 2.6.1 on the Mac.

This also led me to the solution, I was still using some code that used sizers in a 2.4 fashion, which didn't work too well with 2.6 in this case. In any case, thanks for all the suggestions.

KevinHock
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 236
Joined: Sat Sep 04, 2004 1:49 pm
Location: Ohio, USA
Contact:

Post by KevinHock » Sun Jul 31, 2005 12:41 pm

So it turned out to be an issue with sizers?

Post Reply