Prev: unsubscribe
Next: London Ruby Contractor Needed
From: BruceL on 29 Jul 2010 11:25 Trying to center a messagebox on the parent instead of on whole screen. Read the docs, they say to use #center_on_parent before calling _modal. Doesnt seem to work, any ideas? ------------------------------ require 'rubygems' require 'wx' include Wx class MyFrame < Frame def initialize() super(nil,-1,'The Rabbit Hole',:size => [300,300]) @diagYesno = MessageDialog.new(self,'are you sure','White Rabbit asks',YES_NO) @diagYesno.center_on_parent(BOTH) #@my_panel = Panel.new(self) @mybutton = Button.new(self,-1,'Drink Me',:pos =>[2,2],:size => [30,20]) evt_button(@mybutton) {onclick} show end def onclick case @diagYesno.show_modal when Wx::ID_YES yesno = 'Yes' when Wx::ID_NO yesno = 'No' end puts yesno end end class MyApp < App def on_init frame1 = MyFrame.new end end ### Main Logic MyApp.new.main_loop()
|
Pages: 1 Prev: unsubscribe Next: London Ruby Contractor Needed |