]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/ComboCtrl.py
fix building/running of tex2rtf
[wxWidgets.git] / wxPython / demo / ComboCtrl.py
index 3b4f5e917e1bc071d32dcdecf759b492a42f6880..d12ff37dc524d5af35fd90dd2157c4742dd4693b 100644 (file)
@@ -68,8 +68,7 @@ class ListCtrlComboPopup(wx.ListCtrl, wx.combo.ComboPopup):
     def Create(self, parent):
         self.log.write("ListCtrlComboPopup.Create")
         wx.ListCtrl.Create(self, parent,
-                           style=wx.LC_LIST|wx.LC_SINGLE_SEL|
-                           wx.LC_SORT_ASCENDING|wx.SIMPLE_BORDER)
+                           style=wx.LC_LIST|wx.LC_SINGLE_SEL|wx.SIMPLE_BORDER)
         self.Bind(wx.EVT_MOTION, self.OnMotion)
         self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
         return True
@@ -261,7 +260,10 @@ class ComboCtrlWithCustomPopupAnim(wx.combo.ComboCtrl):
         dc = wx.ScreenDC()
         bmp = wx.EmptyBitmap(rect.width, rect.height)
         mdc = wx.MemoryDC(bmp)
-        mdc.Blit(0, 0, rect.width, rect.height, dc, rect.x, rect.y)
+        if "wxMac" in wx.PlatformInfo:
+            pass
+        else:
+            mdc.Blit(0, 0, rect.width, rect.height, dc, rect.x, rect.y)
         del mdc
         self.aniBackBitmap = bmp
 
@@ -316,12 +318,12 @@ class FileSelectorCombo(wx.combo.ComboCtrl):
         wx.combo.ComboCtrl.__init__(self, *args, **kw)
 
         # make a custom bitmap showing "..."
-        bw, bh = 16, 16
+        bw, bh = 14, 16
         bmp = wx.EmptyBitmap(bw,bh)
         dc = wx.MemoryDC(bmp)
 
         # clear to a specific background colour
-        bgcolor = wx.Colour(255,0,255)
+        bgcolor = wx.Colour(255,254,255)
         dc.SetBackground(wx.Brush(bgcolor))
         dc.Clear()
 
@@ -331,7 +333,6 @@ class FileSelectorCombo(wx.combo.ComboCtrl):
         font.SetWeight(wx.FONTWEIGHT_BOLD)
         dc.SetFont(font)
         tw,th = dc.GetTextExtent(label)
-        print tw, th
         dc.DrawText(label, (bw-tw)/2, (bw-tw)/2)
         del dc
 
@@ -354,7 +355,7 @@ class FileSelectorCombo(wx.combo.ComboCtrl):
         if dlg.ShowModal() == wx.ID_OK:
             self.SetValue(dlg.GetPath())
         dlg.Destroy()
-
+        self.SetFocus()
 
     # Overridden from ComboCtrl to avoid assert since there is no ComboPopup
     def DoSetPopupControl(self, popup):
@@ -414,13 +415,14 @@ class TestPanel(wx.Panel):
         fgs.Add(wx.StaticText(self, -1, "Custom popup animation"))
         for word in "How cool was that!?  Way COOL!".split():
             popup.AddItem(word)
+        if "wxMac" in wx.PlatformInfo:
+            cc.SetValue("Sorry, animation not working yet on Mac")
 
 
         cc = FileSelectorCombo(self, size=(250, -1))
         fgs.Add(cc)
         fgs.Add((10,10))
         fgs.Add(wx.StaticText(self, -1, "Custom popup action, and custom button bitmap"))
-        
 
         box = wx.BoxSizer()
         box.Add(fgs, 1, wx.EXPAND|wx.ALL, 20)
@@ -458,6 +460,10 @@ def runTest(frame, nb, log):
 overview = """<html><body>
 <h2><center>wx.combo.ComboCtrl</center></h2>
 
+A combo control is a generic combobox that allows a totally custom
+popup. In addition it has other customization features. For instance,
+position and size of the dropdown button can be changed.
+
 </body></html>
 """