# SashWindowLayout design

**URL:** <https://www.ruby-forum.com/t/sashwindowlayout-design/120059>\
**Category:** wxRuby\
**Created:** [November 13, 2007, 1:43pm UTC](https://www.ruby-forum.com/t/sashwindowlayout-design/120059 "2007-11-13T13:43:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jari\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@Jari\_W](https://www.ruby-forum.com/u/Jari_W)\
**Post date:** [November 13, 2007, 1:43pm UTC](https://www.ruby-forum.com/t/sashwindowlayout-design/120059/1 "2007-11-13T13:43:06Z")

</div>

Hello!

I want a SashWindowLayout with 3 small panels (below each other) on the  
left side and the big remaining area to the right. All walls movable.

The approach that I’ve used to get kind of the effect I wanted was to  
first add the right-side area (right-aligned), then add 2 other  
top-aligned panels. Which leaves the remaining area to the panel at the  
bottom left.

I got a problem with this approach, though. When resizing the main  
window, the wall between the left and right part moves as well  
(=increasing/decreasing the width of all left-side panels). How do I get  
it to not resize?

Best regards,

Jari W.

---

<div class="post-metadata">

**Author:** ![Jari\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@Jari\_W](https://www.ruby-forum.com/u/Jari_W)\
**Post date:** [November 13, 2007, 8:13pm UTC](https://www.ruby-forum.com/t/sashwindowlayout-design/120059/2 "2007-11-13T20:13:47Z")

</div>

Jari W. wrote:

> (=increasing/decreasing the width of all left-side panels). How do I get  
> it to not resize?

I think the easiest solution is to make the right-hand area the  
‘remaining’ area, and have the others as panels. Have a look at  
sample/bigdemo/wxSashWindow.rb which seems to do this kind of thing.

The wxWidgets documents describe a sophisticated mechanism using  
CalculateLayoutEvent. I haven’t used this class so didn’t really get  
what was going on. But I’ll try and add the LayoutEvent classes so  
they’re at least available in wxRuby.

alex

---

<div class="post-metadata">

**Author:** ![Jari\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@Jari\_W](https://www.ruby-forum.com/u/Jari_W)\
**Post date:** [November 13, 2007, 9:11pm UTC](https://www.ruby-forum.com/t/sashwindowlayout-design/120059/3 "2007-11-13T21:11:13Z")

</div>

Alex F. wrote:

> > window, the wall between the left and right part moves as well  
> > (=increasing/decreasing the width of all left-side panels). How do I get  
> > it to not resize?
> 
> I think the easiest solution is to make the right-hand area the  
> ‘remaining’ area, and have the others as panels. Have a look at  
> sample/bigdemo/wxSashWindow.rb which seems to do this kind of thing.

Actually, I used the bigdemo sample as my starting point, but I failed  
to convert it to what i needed. Bigdemo adds the stacked panels  
horizontally from the left, which then gives the remaining area to the  
right. If I add instead panels from the top, the remaining area is at  
the bottom, and if I don’t have anything at all on the right side, the  
added panels will cover the whole horizontal space.

I’ll probably try to see if it works to put a SashWindowLayout within an  
existing SashWindowLayout.

Best regards,

Jari W.

---

<div class="post-metadata">

**Author:** ![Jari\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a698b9/32.png) [@Jari\_W](https://www.ruby-forum.com/u/Jari_W)\
**Post date:** [November 13, 2007, 9:52pm UTC](https://www.ruby-forum.com/t/sashwindowlayout-design/120059/4 "2007-11-13T21:52:47Z")

</div>

Jari W. wrote:

> Actually, I used the bigdemo sample as my starting point, but I failed  
> to convert it to what i needed. Bigdemo adds the stacked panels  
> horizontally from the left, which then gives the remaining area to the  
> right. If I add instead panels from the top, the remaining area is at  
> the bottom, and if I don’t have anything at all on the right side, the  
> added panels will cover the whole horizontal space.

OK, I haven’t used SashLayoutWindow to know how to make it do that  
specifically.

> I’ll probably try to see if it works to put a SashWindowLayout within an  
> existing SashWindowLayout.

Sounds good. You might find that SplitterWindow is an easier alternative  
for the main partition of the window into left and right. Use  
SplitterWindow#set\_sash\_gravity to apply all the increase in size to the  
“main” right window when the parent frame is resized.

alex
