Page 1 of 1
Can't get wxScrolledWindow to show scrollbars on Mac OS X.
Posted: 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.
Posted: 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.
Posted: 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
Are there any relevant defines?
Posted: 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?
Posted: 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?
Posted: Sat Jul 30, 2005 2:20 pm
I have two theories:
1) The notebook is expanding to the virtual size (which seems unlikely)
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...
Posted: 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.
Posted: Sun Jul 31, 2005 12:41 pm
So it turned out to be an issue with sizers?