Hi, I tried my first steps with wxruby today and I have a problem. I read the doc and wanted to add a button but no matter what I do the button has always the size of the whole frame also if I told him another size like in this example in which I gave him this size button = Button.new(self, -1, "Push me",Point.new(10,10),Size.new(50,10)) but it always has the size of the whole frame?: #!/usr/bin/env ruby $Verbose=true require ''rubygems'' require ''wx'' include Wx class MyFrame < Frame def initialize super(nil, -1, "Threepwood",Point.new(400,250),Size.new(600,200),DEFAULT_FRAME_STYLE) button = Button.new(self, -1, "Push me",Point.new(10,10),Size.new(50,10)) evt_button(button.get_id()) {|event| on_button(event)} show() end def message(text, title) m = Wx::MessageDialog.new(self, text, title, Wx::OK | Wx::ICON_INFORMATION) m.show_modal() end def on_button(event) message("event recieved!!", "Button event") end end class MinimalApp < App def on_init MyFrame.new end end MinimalApp.new.main_loop #eof Can someone help me with this? greets -- kazaam <kazaam@oleco.net>
kazaam wrote:> Hi, > I tried my first steps with wxruby today and I have a problem. I read the doc and wanted to add a button but no matter what I do the button has always the size of the whole frame also if I told him another size like in this example in which I gave him this size button = Button.new(self, -1, "Push me",Point.new(10,10),Size.new(50,10)) but it always has the size of the whole frame?In initialize, try: panel = Panel.new(self) button = Button.new(panel, ...) I think, if a Frame has only one child widget, the child widget is sized to fit the whole available space in the frame cheers alex
hey thanks that solved my problem :) On Wed, 22 Aug 2007 22:51:49 +0100 Alex Fenton <alex at pressure.to> wrote:> kazaam wrote: > > Hi, > > I tried my first steps with wxruby today and I have a problem. I read the doc and wanted to add a button but no matter what I do the button has always the size of the whole frame also if I told him another size like in this example in which I gave him this size button = Button.new(self, -1, "Push me",Point.new(10,10),Size.new(50,10)) but it always has the size of the whole frame? > In initialize, try: > > panel = Panel.new(self) > button = Button.new(panel, ...) > > I think, if a Frame has only one child widget, the child widget is sized > to fit the whole available space in the frame > > cheers > alex > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users-- kazaam <kazaam at oleco.net>
Possibly Parallel Threads
- TaskBarIcon gives Typerror
- [ wxruby-Bugs-24288 ] rb_str2cstr undefined with Ruby 1.9 and Ubuntu Linux
- error finding library when running test program
- [782] trunk/wxruby2/samples/bigdemo: HtmlHelpWindow sample with helpfile
- [736] trunk/wxruby2/samples/dialogs/dialogs.rb: Fixed crashing bug in on_paint and made the code style more Ruby like.