the bug's actually in ComplexPanel.  let me know if this works.  tests
required to make sure nothing breaks because of this!

l.

lkcl@teenymac:~/pyjamas/library/pyjamas/ui$ git diff
diff --git a/library/pyjamas/ui/ComplexPanel.py b/library/pyjamas/ui/ComplexPane
index 190b747..4bc4cf2 100644
--- a/library/pyjamas/ui/ComplexPanel.py
+++ b/library/pyjamas/ui/ComplexPanel.py
@@ -27,10 +27,20 @@ class ComplexPanel(Panel):
         else:
             self.insert(widget, self.getWidgetCount())

-    def insert(self, widget, container, beforeIndex):
+    def insert(self, widget, container, beforeIndex=None):
+        """ has two modes of operation:
+            widget, beforeIndex
+            widget, container, beforeIndex.
+            if beforeIndex argument is not given, the 1st mode is assumed.
+            this technique is less costly than using *args.
+        """
         if widget.getParent() == self:
             return

+        if beforeIndex is None:
+            beforeIndex = container
+            container = self.getElement()
+
         self.adopt(widget, container)
         self.children.insert(beforeIndex, widget)

Reply via email to