[wxruby-users] RES: Problem centering a label

Christian Schmidt lists at ruby-forum.com
Fri Mar 20 10:34:34 EDT 2009


Hi Alejandro,

this one actually works:

class TarefasNova < Wx::Panel
    def initialize(parent)
      super( parent, 1011, {:style => SIMPLE_BORDER, :name 
=>"NovaTarefa"} );

      box = Wx::BoxSizer.new(Wx::HORIZONTAL);
      box.add_stretch_spacer();
      box.add Wx::StaticText.new(self, -1, 'asdf'), 0, 1
      box.add_stretch_spacer();

      set_sizer box
    end
end

Watch for the parents' constructor - you needn't set size and position.
Also never forget to call Panel#set_sizer or your sizer won't have any 
effect.

hth,
Christian.
-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list