473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1317

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul THompson | last post by:
I have been working for some time to 1) detect tab and shift tab events 2) control the focus on the basis of these events. I have found that I can do this, but continue to have nagging problems. ...
16
by: Michael Winter | last post by:
Other than throwing an exception during the execution of an object's constructor, is there any way to cancel creation of the object in such a way that it leaves a reference to it null or undefined....
7
by: Marina | last post by:
Imagine a form with some fields and an OK buttons that saves the information. Each field has validation logic in the Validating event. If the input is not valid, the control's value is replaced...
0
by: Baseman | last post by:
I am trying to find out how to cancel all TreeView events if an exception occurs during any one of the following... MouseDown BeforeSelect AfterSelect DragDrop DragEnter DragOver...
6
by: PromisedOyster | last post by:
Hi How do I cancel an event in a class where that event is setup in another derived class. See example below. Thanks All our winforms are derived from one of our own classes, BaseForm....
1
by: Vik | last post by:
Is it possible to cancel all the events or a specific event programmatically (for example, in a Page_Load event)? In other words, is it possible to stop a page code execution? Thank you.
2
by: sck10 | last post by:
Hello, I have a LinkButton that I use to open a FormView in ReadOnly mode "ShowList", and a LinkButton to open the same FormView in the Insert mode "NewRecord". If the user clicks "ShowList"...
9
by: pvsundarram | last post by:
hey, i am trying to cancel the keydown event for certain keycodes( for eg:- enter key ).But the cancelling of this event is not happening in firefox. Is there any way to cancel the event in the...
1
by: swethak | last post by:
Hi, I am desiging the calendar application for that purpose i used the below code. But it is for only displys calendar. And also i want to add the events to calendar. In that code displys the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.