469,592 Members | 1,785 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,592 developers. It's quick & easy.

Cancelling events on a COM Object

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 16 '07 #1
3 1197

Oliver Nelson wrote:
>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
Instead of assigning to the variable name, output parameters need to be
returned from the method

Roger


Aug 17 '07 #2
James,

I was getting an error everytime so I thought I had a setup problem...

Sorry everybody...

OLIVER

James Stroud wrote:
Oliver, wait a while before you panic about your post not getting through!

James
Aug 18 '07 #3
Roger,

I tried modifying my code so that I have

def OnBeforeClick(self, Button, Shift, X, Y, Cancel):
print "click"
Cancel = True
return Cancel

But this doesn't seem to have changed anything. Am I doing this wrong?

OLIVER

Roger Upole wrote:
Oliver Nelson wrote:
>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

Instead of assigning to the variable name, output parameters need to be
returned from the method

Roger

Aug 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul THompson | last post: by
16 posts views Thread by Michael Winter | last post: by
6 posts views Thread by PromisedOyster | last post: by
1 post views Thread by Vik | last post: by
2 posts views Thread by sck10 | last post: by
1 post views Thread by swethak | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.