Set_size and ScrolledWindow

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? :slight_smile:

regards,
Magnus Sjöstrand

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? :slight_smile:
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs