I'm trying to position a modal dialog (it's a class derived
from wx.Dialog, and I'm passing a "pos" parameter to
wx.Dialog.__init__()). It just won't work.
For example, I modified Validate.py to pass a position
parameter to wx.Dialog.__init__(), and it doesn't seem to work.
The behavior is identical with or without the "pos" parameter.
I tried passing both a wxPoint and a tuple (shown below).
Neither works. I even put a print statement in wx/windows.py to
make sure that the "pos" argument was being passed to
_windows.new_Dialog(), and it seems to be OK.
I also modified the Dialog.py, and it does work -- but it's not
using wx.Dialog.__init__(), it's doing
pre = wx.PreDialog()
pre.Create(..., pos, ...)
Here is a patch against the 2.5.1.5 demo files to show what
I've tried (Dialog.py does work, Validate.py doesn't).
Can somebody clue me in on what's happening?
diff -w -x '*pyc' -r -U5 wxPython-2.5.1.5/demo/Dialog.py wxPython-demos-gbe/demo/Dialog.py
--- wxPython-2.5.1.5/demo/Dialog.py 2004-04-01 13:49:18.000000000 -0600
+++ wxPython-demos-gbe/demo/Dialog.py 2004-05-20 15:42:18.343930258 -0500
@@ -85,15 +85,15 @@
sizer.Fit(self)
···
#---------------------------------------------------------------------------
def runTest(frame, nb, log):
- win = TestDialog(frame, -1, "This is a Dialog", size=(350, 200),
+ win = TestDialog(frame, -1, "This is a Dialog", size=(350, 200), pos=(500,500),
#style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME
style = wx.DEFAULT_DIALOG_STYLE
)
- win.CenterOnScreen()
+ #win.CenterOnScreen()
val = win.ShowModal()
if val == wx.ID_OK:
log.WriteText("You pressed OK\n")
else:
diff -w -x '*pyc' -r -U5 wxPython-2.5.1.5/demo/Validator.py wxPython-demos-gbe/demo/Validator.py
--- wxPython-2.5.1.5/demo/Validator.py 2004-04-01 13:49:18.000000000 -0600
+++ wxPython-demos-gbe/demo/Validator.py 2004-05-20 15:42:40.435655816 -0500
@@ -159,11 +159,11 @@
#----------------------------------------------------------------------
class TestValidateDialog(wx.Dialog):
def __init__(self, parent):
- wx.Dialog.__init__(self, parent, -1, "Validated Dialog")
+ wx.Dialog.__init__(self, parent, -1, "Validated Dialog", pos=(500,500))
self.SetAutoLayout(True)
VSPACE = 10
fgs = wx.FlexGridSizer(0, 2)
--
Grant Edwards
grante@visi.com