[IronPython] Blocker: ProcessDialogKey on TextBox subclass
Glenn Jones
glenn.k.jones+ipy at gmail.com
Fri Nov 28 14:00:47 CET 2008
Hi All,
Here is a little app that illustrates an issue that we've just discovered:
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('IronPython')
from System.Windows.Forms import Form, Application, TextBox
class MyTextBox(TextBox):
def ProcessDialogKey(self, key):
print key
#super(MyTextBox, self).ProcessDialogKey(key) # Fails with a stack
overflow
#TextBox.ProcessDialogKey(self, key) # Fails with:
Microsoft.Scripting.ArgumentTypeException: cannot access protected member
ProcessDialogKey without a python subclass of TextBoxBase
class ThisApp(Form):
def __init__(self):
Form.__init__(self)
tb = MyTextBox()
self.Controls.Add(tb)
Application.Run(self)
def main():
f = ThisApp()
if __name__ == '__main__':
main()
---------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------
Uncommenting either of the two commented lines produces the results on that
line when a key is pressed in the text box. The second method of calling
ProcessDialogKey worked in IPy 1.
This is likely to block our progress on porting Resolver One to IPy2 unless
there is a different way of accomplishing the same thing.
Thanks
Glenn & Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20081128/0a405734/attachment.html>
More information about the Ironpython-users
mailing list