Wxruby dialog box, not centering on parent

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()

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs