[IronPython] the new version cannot find an overload for ToolStripItemCollection.AddRange when using a list
Cheemeng
lcm at spiralcomms.com
Tue Jun 20 06:40:45 CEST 2006
hi ,
the doc for ToolStripItemCollection.AddRange list the 2 overloads as:
ToolStripItemCollection.AddRange (ToolStripItem[])
ToolStripItemCollection.AddRange (ToolStripItemCollection)
in prev ironpython version, we can pass a python list as argument,
in the newest version, this gives TypeError: no applicable overload
Dun know whether this is a new bug
OR prev, it works without intention to :)
below is the test program,
import clr
clr.AddReferenceByPartialName("System.Windows.Forms")
clr.AddReferenceByPartialName("System.Drawing")
from System.Windows.Forms import *
from System.Drawing import *
class TestMenu(Form):
def __init__(self):
self.InitializeComponent()
def InitializeComponent(self):
self.ClientSize = Size(300, 200)
self.Name = self.Text = "Test Menu"
ms = ToolStripMenuItem()
ms.Name = ms.Text = "Hello"
ctxMenu = ContextMenuStrip()
ctxMenu.Items.AddRange([ms]) # doesn't work in new version
#ctxMenu.Items.Add(ms) # this works
self.ContextMenuStrip = ctxMenu
f = TestMenu()
Application.Run(f)
thanks.
regards
cheemeng
More information about the Ironpython-users
mailing list