[IronPython] [python] Difference in 1.1 and 2.0 with Dialog Result
Davy Mitchell
daftspaniel at gmail.com
Sun Dec 23 23:15:56 CET 2007
Yes my initial code was flat wrong :-)
I was using
if fbd.ShowDialog():
etc...
For reference, the IPY1.1 result:
>>> bool(DialogResult.OK)
False
>>> DialogResult.OK.value__
1
> but it is still odd that this enumeration now evaluates to False.
Yes, very odd but I guess it is never safe to rely on the value of an enum.
Davy
On Dec 23, 2007 5:05 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> Davy Mitchell wrote:
> > import clr
> > clr.AddReference('System.Windows.Forms')
> > from System.Windows.Forms import DialogResult
> > if DialogResult.OK:
> > print "Boo!"
> >
> > The above prints Boo! in 1.1 and early 2.0 Alphas i.e. DialogResult.OK
> > resolves to TRUE.
> >
> > A6 and A7 (didn't try any others!) nothing is printed i.e.
> > DialogResult.OK resolves to FALSE.
> >
> > Now, I am changing my dialog code anyway but is this a deliberate change?
> >
> >
>
> Hmm.. (IP2.0 A7)
>
> >>> import clr
> >>> clr.AddReference('System.Windows.Forms')
> >>> from System.Windows.Forms import DialogResult
> >>> bool(DialogResult.OK)
> False
> >>> DialogResult.OK.value__
> 1
>
> Odd.
>
> Of course the right thing to be doing is:
>
> if result == DialogResult.OK:
>
> but it is still odd that this enumeration now evaluates to False.
>
> Michael
> http://www.manning.com/foord
> > Cheers,
> > Davy
> >
> >
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
--
Davy Mitchell
Blog - http://www.latedecember.co.uk/sites/personal/davy/
Twitter - http://twitter.com/daftspaniel
Skype - daftspaniel needgod.com
More information about the Ironpython-users
mailing list