Debugging ActiveX Control Events in wxPython/PythonWin
Charles Medcoff
cmedcoff at my-deja.com
Wed Aug 30 09:21:53 EDT 2000
I am attemping to create a window (wxWindow) that hosts an ActiveX
control. I have not had any problems getting through the
window/control creation process but my control subclass event handlers
are never called. I've stepped (debugged) all the way thought wxPython
and into the Control.HookOleEvent() method in the PythonWin activeX.py
module. I have observed the successful search for event handler methods
in my subclass. Where do I go from here to debug the problem? Here is
the code
##import win32com.client
from wxPython.wx import *
g_rslinx = None
if wxPlatform == '__WXMSW__':
from wxPython.lib.activexwrapper import MakeActiveXClass
import win32com.client.gencache
try:
rsWhoLibModule = win32com.client.gencache.EnsureModule
('{172C823C-7624-11D0-A1BF-0060B01A661C}', 0, 1, 0)
except:
raise ImportError("Can't load RSWho Type Library")
# Class for event handling
class PyRsWho(wxWindow):
def OnEnter(self, Selection):
print "OnEnter"
def OnSelChanged(self, Selection):
print "OnSelChangled"
def OnClientMenuItemSelected(self, Path, MenuID):
print "OnClientMenuItemSelected(self, Path, MenuID):"
def OnRightClick(self, Path, ClientMenu):
print "OnRightClick(self, Path, ClientMenu):"
def OnDoubleClick(self, Selection):
print "OnDoubleClick(self, Selection):"
class App(wxApp):
def OnInit(self):
self.frame = wxFrame(NULL, -1, "Py RsPath", wxPoint(200,200),
wxSize(400,400))
self.frame.Show(true)
self.SetTopWindow(self.frame)
rsWhoClass = MakeActiveXClass(rsWhoLibModule.RSWho, PyRsWho)
self.rsWho = rsWhoClass(self.frame, -1, wxPoint(0,0),
self.frame.GetClientSize())
return 1
app = App(0)
app.MainLoop()
I know the control works becase I've hosted it in C++ and VB. I've
written nearly identical python code for hosting another control and
have had no problems there. Suggestions?
Regards,
Chuck
--
Charles Medcoff
Senior Systems Engineer
Pyramid Solutions
1850 Research Drive, Suite 300
Troy, MI 48083
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list