3 wxSugar questions

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.

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