]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/src/controls2.i
Various little tweaks
[wxWidgets.git] / wxPython / src / controls2.i
index aa63f8a257b7a6e7f6bbd0aee3a8b632c3dc06d6..85334a3ddf939557fc71c9abec00aff3ca3edbaf 100644 (file)
@@ -444,14 +444,15 @@ public:
     %addmethods {
         %new wxListItem* GetColumn(int col) {
             wxListItem item;
+            item.SetMask(0xFFFF);
             if (self->GetColumn(col, item))
                 return new wxListItem(item);
             else
                 return NULL;
         }
-    }  // The OOR typemaps don't know what to do with the %new, so fix it up.
+    } // The OOR typemaps don't know what to do with the %new, so fix it up.
     %pragma(python) addtoclass = "
-    def GetItem(self, *_args, **_kwargs):
+    def GetColumn(self, *_args, **_kwargs):
         val = apply(controls2c.wxListCtrl_GetColumn,(self,) + _args, _kwargs)
         if val is not None: val.thisown = 1
         return val
@@ -492,7 +493,7 @@ public:
     %pragma(python) addtoclass = "
     def GetItem(self, *_args, **_kwargs):
         val = apply(controls2c.wxListCtrl_GetItem,(self,) + _args, _kwargs)
-        val.thisown = 1
+        if val is not None: val.thisown = 1
         return val
     "
 
@@ -1075,11 +1076,13 @@ public:
         int rval = 0;
         bool found;
         wxPyBeginBlockThreads();
-        if ((found = m_myInst.findCallback("OnCompareItems")))
-            rval = m_myInst.callCallback(Py_BuildValue(
-                "(OO)",
-                wxPyConstructObject((void*)&item1, "wxTreeItemId"),
-                wxPyConstructObject((void*)&item2, "wxTreeItemId")));
+        if ((found = m_myInst.findCallback("OnCompareItems"))) {
+            PyObject *o1 = wxPyConstructObject((void*)&item1, "wxTreeItemId");
+            PyObject *o2 = wxPyConstructObject((void*)&item2, "wxTreeItemId");
+            rval = m_myInst.callCallback(Py_BuildValue("(OO)",o1,o2));
+            Py_DECREF(o1);
+            Py_DECREF(o2);
+        }
         wxPyEndBlockThreads();
         if (! found)
             rval = wxTreeCtrl::OnCompareItems(item1, item2);