[Wxruby-users] Can't change button-size?

kazaam kazaam at oleco.net
Wed Aug 22 13:39:17 EDT 2007


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 at oleco.net>


More information about the wxruby-users mailing list