Forum: wxRuby ListBox's overlapping

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
59193d8082ee0fe75675d3bb376cf2ba?d=identicon&s=25 Pierre Pierre (pierre_p)
on 2009-04-10 07:14

I have a bug which I can't solve at the moment. I tried various
solutions, changing the sizers and lots of different ways, I still
couldn't fix it.

In my code, I have basically two ListBox in the same panel, one above
the other.
When the upper ListBox has too many elements, I have a nice scroll bar,
and looks good. But When I resize my complete frame, it draws itself
over the bottom one, and I can't see it anymore. And the scroll bar is
even gone, so I can't even see all the elements.

Here is my code:

def initialize title, xml_h
    super(nil, -1, title)
  @xml_helper = xml_h

  global_sizer =

  @top_p =
  @bottom_p =

  global_sizer.add(@top_p, 3, GROW|ALL, 2)
  global_sizer.add(@bottom_p, 1, GROW|ALL, 2)

  top_sizer =
@xml_helper.get_magicians, LB_SINGLE|LB_SORT|DOUBLE_BORDER)
  evt_listbox @m_list, :on_magician_pressed
  top_sizer.add(@m_list,1, GROW|ALL, 2)

  @mc =
  evt_media_loaded @mc,:on_media_loaded
  top_sizer.add(@mc, 3, GROW|ALL, 2)

    right_sizer =, 0, 2, 2)
  right_p =
  right_p.set_sizer right_sizer
  @v_list =, -1, DEFAULT_POSITION, DEFAULT_SIZE, [],
    evt_listbox @v_list, :on_video_pressed
    right_sizer.add @v_list

  @t_list =, -1, DEFAULT_POSITION, DEFAULT_SIZE, [],
  evt_listbox @t_list, :on_trick_pressed
    right_sizer.add @t_list
  top_sizer.add(right_p, 1, ALIGN_RIGHT, 2)
  @top_p.sizer = top_sizer
  self.sizer = global_sizer

Note that the @bottom_p isn't used, but will be later, once I have fixed
So the problematic code lies with the right_sizer and the right_p (p for
The @v_list is the upper ListBox and @t_list is the bottom one.

Appreciate the help,

06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2009-04-14 14:15
(Received via mailing list)
Hi Pierre

Pierre Pierre wrote:
> Here is my code:
> def initialize title, xml_h

[ ... ]

I'm afraid that most people who might be able to help with this don't
have time to work through a long snippet this copied straight from an
application, and figure out what's going on. If you want help with code,
please reduce it to a bare minimum that runs on its own, and
demonstrates just the problem. Please see the guidelines here:

The kind of problem you describe with items overlapping is usually
caused by failing to add some control to a sizer, or adding it to the
wrong sizer (eg not one belonging to its parent). I would check through
the controls for this. Perhaps also consider using or at least
prototyping using an XRC editor like DialogBlocks for layouts, which can
really help understanding sizers.

Lastly I suggest also reading the Style Guide, which will help you
structure and write wxRuby code in a more readable way:

59193d8082ee0fe75675d3bb376cf2ba?d=identicon&s=25 Pierre Pierre (pierre_p)
on 2009-04-15 02:42

Thanks again for this reply as well.
Actually, I have fixed that issue, by simplifying the behavior (not 100%
what I wanted) and also changing the sizer.

Thanks also for that Style Guide, it will definitely help me.

This topic is locked and can not be replied to.