<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=579221023-08012004><FONT face=Arial size=2>I think there's a
bug in the toolbar event handler. Here's the relevant
code:</FONT></SPAN></DIV>
<DIV><SPAN class=579221023-08012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=579221023-08012004><FONT face=Arial
size=2>#-------------------------------------------------------</FONT></SPAN></DIV>
<DIV><SPAN class=579221023-08012004><FONT face=Arial size=2>class
KtIde(WinForms.Form):<BR> """A simple Integrated Development
Environment for Python.NET<BR> from Kokopelli
Technology."""</FONT></SPAN></DIV>
<DIV> </DIV>
<DIV><SPAN class=579221023-08012004><FONT face=Arial size=2>
def __init__(self):<BR> # a bunch of
stuff...</FONT></SPAN></DIV><SPAN class=579221023-08012004>
<DIV><FONT face=Arial
size=2> <BR>
# Add a toolbar<BR> self.toolBar1 =
WinForms.ToolBar()<BR> self.imageList1
=
WinForms.ImageList(self.components)<BR>
self.toolBarButton1 =
WinForms.ToolBarButton()<BR>
self.toolBar1.Buttons.Add(self.toolBarButton1)<BR>
self.toolBar1.ImageList =
self.imageList1<BR>
self.toolBar1.Location = Point(0,
30)<BR> self.toolBar1.Name =
"toolBar1"<BR>
self.toolBar1.ShowToolTips = True<BR>
self.toolBar1.Size = Size(632, 28)<BR>
self.toolBar1.TabIndex = 0<BR>
#<BR> # Image
list<BR>
#<BR> self.imageList1.ImageSize =
Size(16, 16)<BR>
self.imageList1.TransparentColor =
Color.Transparent<BR> fname =
"ARW01RT.ICO" <BR>
self.imageList1.Images.Add(Image.FromFile(fname))<BR> <BR>
# toolBarButtons<BR>
self.toolBarButton1.ImageIndex = 0</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT><SPAN class=579221023-08012004><FONT face=Arial
size=2> ######################
PROBLEM ########################</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2>
self.toolBar1.ButtonClick += self.toolBar1_ButtonClick </FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT size=2><SPAN
class=579221023-08012004>
</SPAN>#<SPAN class=579221023-08012004> Or is it...?</SPAN></FONT></FONT></DIV>
<DIV><FONT><SPAN class=579221023-08012004></SPAN><FONT face=Arial><FONT
size=2><SPAN class=579221023-08012004>
#self.toolBar1.ButtonClick +=
</SPAN>WinForms.ToolBarButtonClickEventHandler(self.toolBar1_ButtonClick)</FONT></FONT></FONT></DIV>
<DIV><SPAN class=579221023-08012004><FONT face=Arial
size=2>
##########################################################</FONT></SPAN></DIV>
<DIV><FONT><FONT face=Arial><FONT size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><SPAN class=579221023-08012004><FONT face=Arial
size=2> # more
stuff....</FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT><SPAN class=579221023-08012004><FONT face=Arial
size=2></FONT></SPAN></FONT></FONT> </DIV>
<DIV><FONT><FONT><SPAN class=579221023-08012004><FONT face=Arial
size=2> def toolBar1_ButtonClick(self, sender,
args):</FONT></SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT><SPAN class=579221023-08012004><FONT face=Arial
size=2> '''The toolbar event
handler'''<BR>
MessageBox.Show(args.ToString())<BR>
#~ if args.Button ==
self.toolBarButton1:<BR>
#~ MessageBox.Show("Hey, it works!")</FONT></SPAN></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004><FONT face=Arial
size=2>#-------------------------------------------------------</FONT></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>This bombs every
time I press the toolbar button -- unhandled exception. Message
is:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>**************
Exception Text **************<BR>Python.Runtime.PythonException: Exception of
type Python.Runtime.PythonException was thrown.<BR> at
Python.Runtime.Dispatcher.Dispatch(ArrayList args)<BR> at
__System_Windows_Forms_ToolBarButtonClickEventHandlerDispatcher.Invoke(Object ,
ToolBarButtonClickEventArgs )<BR> at
System.Windows.Forms.ToolBar.OnButtonClick(ToolBarButtonClickEventArgs
e)<BR> at System.Windows.Forms.ToolBar.WmReflectCommand(Message&
m)<BR> at System.Windows.Forms.ToolBar.WndProc(Message&
m)<BR> at
System.Windows.Forms.ControlNativeWindow.OnMessage(Message&
m)<BR> at
System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)<BR>
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
wparam, IntPtr lparam)<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>Any
clues?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>Also, this is the
most fun I've had programming in a LONG time. MFC is out the window.
Brian -- my hat is off to you. Many thanks for your
efforts.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004>Cheers,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004>--Thane</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=579221023-08012004></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>Thane
Plummer</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=579221023-08012004>CEO Magna
Capital</DIV></SPAN></FONT>
<DIV><FONT face=Arial size=2></FONT></FONT></FONT></SPAN> </DIV>
<DIV> </DIV>
<DIV align=left><FONT face=Georgia>"La perfection est atteinte non quand il ne
reste rien à ajouter, mais quand il ne reste rien à enlever"</FONT></DIV>
<DIV align=left><FONT face=Georgia>Antoine de St. Exupery from <I>The Little
Prince</I> (perfection is reached not when there's nothing left to add,
but when there's nothing left to remove)</FONT><BR></DIV>
<DIV> </DIV></BODY></HTML>