# 3 wxSugar questions

**URL:** <https://www.ruby-forum.com/t/3-wxsugar-questions/119472>\
**Category:** wxRuby\
**Created:** [November 7, 2007, 9:25am UTC](https://www.ruby-forum.com/t/3-wxsugar-questions/119472 "2007-11-07T09:25:08Z")\
**Posts on this page:** 2\
**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 7, 2007, 9:25am UTC](https://www.ruby-forum.com/t/3-wxsugar-questions/119472/1 "2007-11-07T09:25:08Z")

</div>

A bit new to wxRuby and have 2 questions regarding wxSugar:

1. I only find one sample application for wxSugar, but as I understand  
from the docs, wsSugar is the preferred approach. Are there any more  
wxSugar samples available somewhere?

2. When I run sugar-sample.rb, I get a couple of warnings: “listen is  
deprecated, use evt\_xxx directly”. Just wanted to check: Is this sample  
outdated or is there some version mismatch?

3. Again when using sugar-sample.rb, the bottom part of the list box is  
covered by the panel with the buttons/dropdown/edit controls. I have to  
stretch the window quite much to get all the list box visible (on  
Windows XP). Is this the intended behavior? If I want to get the list  
box automatically resized according to its panel, how do I do that?

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 7, 2007, 11:34am UTC](https://www.ruby-forum.com/t/3-wxsugar-questions/119472/2 "2007-11-07T11:34:59Z")

</div>

Hi Jari

Jari W. wrote:

> A bit new to wxRuby and have 2 questions regarding wxSugar:
> 
> 1. I only find one sample application for wxSugar, but as I understand  
> from the docs, wsSugar is the preferred approach. Are there any more  
> wxSugar samples available somewhere?

wxSugar is in a slightly limbo position at the moment. A few months ago  
we held a survey and there was a decisive vote in favour of adding most  
of the nice ‘sugar’ features into core wxRuby. So wxSugar has a few odds  
and ends that might be useful, but the most-wanted features are now part  
of wxRuby.

Some of the wxRuby samples are updated to a ‘sugar’ style - eg  
minimal.rb, event.rb, nothing.rb.

I should update the wiki to reflect this - sorry for the confusion.

> 1. When I run sugar-sample.rb, I get a couple of warnings: “listen is  
> deprecated, use evt\_xxx directly”. Just wanted to check: Is this sample  
> outdated or is there some version mismatch?

wxRuby 1.9.2 added nicer event handling syntax to the core library, so  
“listen” in wxSugar isn’t really relevant, but is kept for backwards  
compatibility. Have a look at the “event handling tutorial” in the  
current wxRuby docs for information on the options for setting up event  
handlers.

> 1. Again when using sugar-sample.rb, the bottom part of the list box is  
> covered by the panel with the buttons/dropdown/edit controls. I have to  
> stretch the window quite much to get all the list box visible (on  
> Windows XP). Is this the intended behavior? If I want to get the list  
> box automatically resized according to its panel, how do I do that?

I’ll check this out. “Sizers” are the general way to fit subwindows  
within a larger window. It may be that a call to “sizer.layout” is  
needed in the frame’s initializer - this tells the sizer to recalculate  
the size of all the child windows.

cheers  
alex
