Opened 17 months ago

Closed 16 months ago

Last modified 16 months ago

#15187 closed defect (fixed)

Scroll doesn't work as expected when a wxPanel is under a wxScrolledWindow on Mac with Cocoa

Reported by: Tiwenty Owned by: csomor
Priority: normal Milestone: 2.9.5
Component: wxOSX-Cocoa Version: stable-latest
Keywords: scroll, wxscrolledwindow, wxpanel, cocoa Cc:
Blocked By: Blocking:
Patch: no

Description

When I use wxScrolledWindow without wxPanel under it, just wxBoxSizer, wxStaticText etc., it doesn't act as everyone would have expected. The scroll works when we take it with the mouse, but the mouse wheel does nothing and the scrollbar doesn't take all the window height. But this last one is not a serious problem. On Windows with the same WxWidgets version and code it works.

Attachments (3)

Archive.zip download (802 bytes) - added by Tiwenty 17 months ago.
Test code that makes the scrollbar not works
minimal.cpp download (7.3 KB) - added by Tiwenty 17 months ago.
A little modification of the minimal sample in order to simply show the bug
diff download (856 bytes) - added by Tiwenty 17 months ago.
diff file of sample minimal.cpp with my modified version

Download all attachments as: .zip

Change History (9)

Changed 17 months ago by Tiwenty

Test code that makes the scrollbar not works

Changed 17 months ago by Tiwenty

A little modification of the minimal sample in order to simply show the bug

comment:1 Changed 17 months ago by Tiwenty

If anybody wants a diff instead of the complete sample minimal.cpp file, here it is made with the built-in diff command in OSX:

172,173c172,173
<     /*CreateStatusBar(2);
<     SetStatusText("Welcome to wxWidgets!");*/
---
>     CreateStatusBar(2);
>     SetStatusText("Welcome to wxWidgets!");
175,190d174
<     
<     // My code
<     wxPanel *colorpanel;
<     wxBoxSizer *mainsizer = new wxBoxSizer(wxVERTICAL);
<     wxSizer *mastersizer = new wxBoxSizer(wxHORIZONTAL);
<     wxScrolledWindow *scroll = new wxScrolledWindow(this, wxID_ANY);
<     for(int i=0; i<10; i++){
<         colorpanel = new wxPanel(scroll, wxID_ANY, wxDefaultPosition, wxSize(-1, 40));
<         colorpanel->SetBackgroundColour(wxColour(96, 114, 134));
<         mainsizer->Add(colorpanel, 0, wxEXPAND | wxBOTTOM, 1);
<     }
<     scroll->SetSizer(mainsizer);
<     scroll->FitInside();
<     scroll->SetScrollRate(5, 5);
<     mastersizer->Add(scroll, 1, wxEXPAND);
<     this->SetSizer(mastersizer);

Changed 17 months ago by Tiwenty

diff file of sample minimal.cpp with my modified version

comment:2 Changed 17 months ago by Tiwenty

I noticed that when I put something under the wxScrolledWindow in my sizer, the scrollbar now takes all the height of its sizer. I solved one of my problems, but the not the biggest one.

comment:3 Changed 16 months ago by csomor

  • Owner set to csomor
  • Status changed from new to accepted

I'm not yet propagating the scroll event to the parent for wxPanels, I have to change that, therein it differs from all other mouse events

comment:4 Changed 16 months ago by csomor

the layout issue is related to the bottom-right-rectangle - the so called 'grow' rect which you needed in former systems, because window borders where not resize 'handles' but you need something as a 'grip'

comment:5 Changed 16 months ago by SC

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [74086]) propagate scroll wheel events to parent, fixes #15187

comment:6 Changed 16 months ago by SC

(In [74087]) don't take resize indicators into account if we are at 10.7 or higher, they don't exist anymore … see #15187

Note: See TracTickets for help on using tickets.