[python-win32] Writing event handlers

Kairen Tan ktan at greenpeace.org
Wed Aug 29 21:34:03 EDT 2018


Hi all,

I’m trying to write some python to consume events from an Event
Handler….without much success.

I’m using a class created using makepy, and on inspecting the file, there
is a block of commented code like:

# Event Handlers
# If you create handlers, they should have the following prototypes:
# def OnBeforeOpen(self, oRecord=defaultNamedNotOptArg):
# def OnBeforeSave(self, oRecord=defaultNamedNotOptArg,
bCancel=defaultNamedNotOptArg):
# def OnAfterSave(self, oRecord=defaultNamedNotOptArg):
# def OnBeforeDelete(self, oRecord=defaultNamedNotOptArg,
bCancel=defaultNamedNotOptArg):
# def OnCloseRecord(self):
# def OnAfterDelete(self, lDatabaseID=defaultNamedNotOptArg,
sImportID=defaultNamedNotOptArg):

*My question is simply, how do I implement this? *

I’ve tried using win32com.server.register.RegisterServer, but I’m stumped
as to what comes after that.

Thanks in advance!

Kai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20180829/bc9ecbc9/attachment.html>


More information about the python-win32 mailing list