472,146 Members | 1,252 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

Canceling events on COM Objects in python

I have MapPoint working in Python, and I'm trying to cancel events on
the map, but I can't seem to make that happen. I'm responding to the
events successfully in my panel object. My code is like this:

global MapPointMod
MapPointMod =
win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Panel):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init__
kwds["style"] = wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClass(MapPointMod.MappointControl,
eventObj=self)
self.window_1 = MyMap(self, -1)
self.window_1.OpenMap("C:\\TEMP\\GPS_ON.ptt")
....
....
def OnBeforeClick(self, Button, Shift, X, Y, Cancel):
print "tada"
My event fires just fine, but I can't seem to figure out how to cancel
the event so that mappoint doesn't do its stuff with it...I've tried
setting Cancel based on the mappoint specs, but it doesn't seem to get
sent back anywhere...

Any ideas please?

Thanx,

OLIVER
Aug 18 '07 #1
2 1234
On Aug 17, 11:54 pm, Oliver Nelson <oli...@ootbc.comwrote:
I have MapPoint working in Python, and I'm trying to cancel events on
the map, but I can't seem to make that happen. I'm responding to the
events successfully in my panel object. My code is like this:

global MapPointMod
MapPointMod =
win32com.client.gencache.EnsureModule("{51C0A9CA-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Panel):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init__
kwds["style"] = wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClass(MapPointMod.MappointControl,
eventObj=self)
self.window_1 = MyMap(self, -1)
self.window_1.OpenMap("C:\\TEMP\\GPS_ON.ptt")
...
...
def OnBeforeClick(self, Button, Shift, X, Y, Cancel):
print "tada"

My event fires just fine, but I can't seem to figure out how to cancel
the event so that mappoint doesn't do its stuff with it...I've tried
setting Cancel based on the mappoint specs, but it doesn't seem to get
sent back anywhere...

Any ideas please?

Thanx,

OLIVER
This probably isn't the best place to post questions of this nature.
You should try the wxPython's user group or the pywin32 group.

http://wxpython.org/maillist.php
http://mail.python.org/mailman/listinfo/python-win32

Is the event you're trying to cancel caught by wxPython's event
handlers or win32?

Mike

Aug 18 '07 #2
Mike,

Thank you for the suggestion. I will ask over there also. The event is
sent back from the COM interface as the code illustrates.
MakeActiveXClass allows me to pass the object that will receive events.
I don't understand much more detail about how it works. It is
certainly a different model than the standard wx event system...

OLIVER

ky******@gmail.com wrote:
On Aug 17, 11:54 pm, Oliver Nelson <oli...@ootbc.comwrote:
>I have MapPoint working in Python, and I'm trying to cancel events on
the map, but I can't seem to make that happen. I'm responding to the
events successfully in my panel object. My code is like this:

global MapPointMod
MapPointMod =
win32com.client.gencache.EnsureModule("{51C0A9C A-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Panel):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init__
kwds["style"] = wx.TAB_TRAVERSAL
wx.Panel.__init__(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClass(MapPointMod.MappointControl,
eventObj=self)
self.window_1 = MyMap(self, -1)
self.window_1.OpenMap("C:\\TEMP\\GPS_ON.ptt")
...
...
def OnBeforeClick(self, Button, Shift, X, Y, Cancel):
print "tada"

My event fires just fine, but I can't seem to figure out how to cancel
the event so that mappoint doesn't do its stuff with it...I've tried
setting Cancel based on the mappoint specs, but it doesn't seem to get
sent back anywhere...

Any ideas please?

Thanx,

OLIVER

This probably isn't the best place to post questions of this nature.
You should try the wxPython's user group or the pywin32 group.

http://wxpython.org/maillist.php
http://mail.python.org/mailman/listinfo/python-win32

Is the event you're trying to cancel caught by wxPython's event
handlers or win32?

Mike
Aug 18 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by HL | last post: by
8 posts views Thread by Marcin Nowak | last post: by
9 posts views Thread by redefined.horizons | last post: by
reply views Thread by Oliver Nelson | last post: by
reply views Thread by Oliver Nelson | last post: by
reply views Thread by Oliver Nelson | last post: by
reply views Thread by Saiars | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.