]> git.saurik.com Git - wxWidgets.git/commitdiff
Use wx.StdDialogButtonSizer
authorRobin Dunn <robin@alldunn.com>
Mon, 7 Feb 2005 19:27:56 +0000 (19:27 +0000)
committerRobin Dunn <robin@alldunn.com>
Mon, 7 Feb 2005 19:27:56 +0000 (19:27 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31825 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/demo/Dialog.py
wxPython/demo/Validator.py
wxPython/wx/lib/dialogs.py

index e9dc898a7608f553c856985d8d1754e2e49cfcaa..5cef4815eac37e039e45e9ec2b7b62a72c0183f0 100644 (file)
@@ -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)
index d31296c7be9c0a18746d54d74fd2ecff09b39ff7..688712c01567ba1d0187bd7e19bbf8ba8dcb99dd 100644 (file)
@@ -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)
index f41541f9dc5937f0b6b3147120de7e2fdfc7a170..fa5c4614352fcf52457c4e91c95a8c8a9a5c2dd4 100644 (file)
@@ -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