# Set\_size and ScrolledWindow

**URL:** <https://www.ruby-forum.com/t/set-size-and-scrolledwindow/144962>\
**Category:** wxRuby\
**Created:** [August 4, 2008, 7:24pm UTC](https://www.ruby-forum.com/t/set-size-and-scrolledwindow/144962 "2008-08-04T19:24:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![psamathos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4491bb/32.png) [@psamathos](https://www.ruby-forum.com/u/psamathos)\
**Post date:** [August 4, 2008, 7:24pm UTC](https://www.ruby-forum.com/t/set-size-and-scrolledwindow/144962/1 "2008-08-04T19:24:01Z")

</div>

Hi,

I’m trying to set the size of a panel by using set\_size. The size does  
change, but the scrollbars in my ScrolledWindow does not activate.

If I create a panel in wxFormBuilder and set the size there it works,  
but not when created from code.

I’ve tried both with and without sizers, set\_virtual\_size and anything  
else I thought was even remotely related.

my code looks like this:

custom\_panel = MyCustomPanel.new(@scrolled\_window)  
custom\_panel.set\_size 800, 6000

@scrolled\_window is initialized by code from xrcise

Which I guessed would work since it works in c++.

I’ve also tried to set the size from MyCustomPanel’s constructor.

What did I miss? 🙂

regards,  
Magnus SjÃ¶strand

---

<div class="post-metadata">

**Author:** ![psamathos](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/4491bb/32.png) [@psamathos](https://www.ruby-forum.com/u/psamathos)\
**Post date:** [August 5, 2008, 9:28pm UTC](https://www.ruby-forum.com/t/set-size-and-scrolledwindow/144962/2 "2008-08-05T21:28:28Z")

</div>

Magnus SjÃ¶strand wrote:

> custom\_panel = MyCustomPanel.new(@scrolled\_window)  
> custom\_panel.set\_size 800, 6000
> 
> @scrolled\_window is initialized by code from xrcise
> 
> Which I guessed would work since it works in c++.
> 
> I’ve also tried to set the size from MyCustomPanel’s constructor.
> 
> What did I miss? 🙂  
> Perhaps you need to call set\_scroll\_rate?

Using sizers is the easiest way. The ScrolledWindow is the parent that  
owns the sizer, the child panel is added to it. But the scrollbars won’t  
show unless the pixel increment is specified with set\_scroll\_rate.

hth  
alex
