From: Robin Dunn Date: Mon, 7 Feb 2005 19:27:56 +0000 (+0000) Subject: Use wx.StdDialogButtonSizer X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0f9da07463f1134a2f8f51ee581fabcf968fa5c5?ds=sidebyside Use wx.StdDialogButtonSizer git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/demo/Dialog.py b/wxPython/demo/Dialog.py index e9dc898a76..5cef4815ea 100644 --- a/wxPython/demo/Dialog.py +++ b/wxPython/demo/Dialog.py @@ -63,22 +63,22 @@ class TestDialog(wx.Dialog): line = wx.StaticLine(self, -1, size=(20,-1), style=wx.LI_HORIZONTAL) sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) - box = wx.BoxSizer(wx.HORIZONTAL) - + btnsizer = wx.StdDialogButtonSizer() + if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(self) - box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5) - - btn = wx.Button(self, wx.ID_OK, " OK ") - btn.SetDefault() + btnsizer.AddButton(btn) + + btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") - box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5) + btnsizer.AddButton(btn) - btn = wx.Button(self, wx.ID_CANCEL, " Cancel ") + btn = wx.Button(self, wx.ID_CANCEL) btn.SetHelpText("The Cancel button cnacels the dialog. (Cool, huh?)") - box.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5) + btnsizer.AddButton(btn) + btnsizer.Finalise() - sizer.Add(box, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) + sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5) self.SetSizer(sizer) self.SetAutoLayout(True) diff --git a/wxPython/demo/Validator.py b/wxPython/demo/Validator.py index d31296c7be..688712c015 100644 --- a/wxPython/demo/Validator.py +++ b/wxPython/demo/Validator.py @@ -188,11 +188,12 @@ class TestValidateDialog(wx.Dialog): fgs.Add(wx.TextCtrl(self, -1, "", validator = TextObjectValidator())) - buttons = wx.BoxSizer(wx.HORIZONTAL) - b = wx.Button(self, wx.ID_OK, "Okay") + buttons = wx.StdDialogButtonSizer() #wx.BoxSizer(wx.HORIZONTAL) + b = wx.Button(self, wx.ID_OK, "OK") b.SetDefault() - buttons.Add(b, 0, wx.ALL, 10) - buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 0, wx.ALL, 10) + buttons.AddButton(b) + buttons.AddButton(wx.Button(self, wx.ID_CANCEL, "Cancel")) + buttons.Finalise() border = wx.BoxSizer(wx.VERTICAL) border.Add(fgs, 1, wx.GROW|wx.ALL, 25) diff --git a/wxPython/wx/lib/dialogs.py b/wxPython/wx/lib/dialogs.py index f41541f9dc..fa5c461435 100644 --- a/wxPython/wx/lib/dialogs.py +++ b/wxPython/wx/lib/dialogs.py @@ -69,17 +69,19 @@ class MultipleChoiceDialog(wx.Dialog): ok = wx.Button(self, wx.ID_OK, "OK") ok.SetDefault() cancel = wx.Button(self, wx.ID_CANCEL, "Cancel") - lc = layoutf.Layoutf('t=t10#1;l=l5#1;r=r5#1;h!%d' % (height,), (self,)) - stat.SetConstraints(lc) - - lc = layoutf.Layoutf('t=b10#2;l=l5#1;r=r5#1;b=t5#3', (self, stat, ok)) - self.lbox.SetConstraints(lc) - - lc = layoutf.Layoutf('b=b5#1;x%w25#1;w!80;h*', (self,)) - ok.SetConstraints(lc) - - lc = layoutf.Layoutf('b=b5#1;x%w75#1;w!80;h*', (self,)) - cancel.SetConstraints(lc) + + dlgsizer = wx.BoxSizer(wx.VERTICAL) + dlgsizer.Add(stat, 0, wx.ALL, 4) + dlgsizer.Add(self.lbox, 1, wx.EXPAND | wx.ALL, 4) + + btnsizer = wx.StdDialogButtonSizer() + btnsizer.AddButton(ok) + btnsizer.AddButton(cancel) + btnsizer.Finalise() + + dlgsizer.Add(btnsizer, 0, wx.ALL | wx.ALIGN_RIGHT, 4) + + self.SetSizer(dlgsizer) self.SetAutoLayout(1) self.lst = lst