473,598 Members | 3,228 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Ensur eModule("{51C0A 9CA-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Pane l):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init_ _
kwds["style"] = wx.TAB_TRAVERSA L
wx.Panel.__init __(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClas s(MapPointMod.M appointControl,
eventObj=self)
self.window_1 = MyMap(self, -1)
self.window_1.O penMap("C:\\TEM P\\GPS_ON.ptt")
....
....
def OnBeforeClick(s elf, 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 1301
On Aug 17, 11:54 pm, Oliver Nelson <oli...@ootbc.c omwrote:
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.Ensur eModule("{51C0A 9CA-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Pane l):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init_ _
kwds["style"] = wx.TAB_TRAVERSA L
wx.Panel.__init __(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClas s(MapPointMod.M appointControl,
eventObj=self)
self.window_1 = MyMap(self, -1)
self.window_1.O penMap("C:\\TEM P\\GPS_ON.ptt")
...
...
def OnBeforeClick(s elf, 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.
MakeActiveXClas s 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.c omwrote:
>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.clien t.gencache.Ensu reModule("{51C0 A9CA-F7B7-4F5A-96F4-43927C6FA50F}",
0, 1, 0)

class MyPanel(wx.Pane l):
def __init__(self, *args, **kwds):
# begin wxGlade: MyPanel.__init_ _
kwds["style"] = wx.TAB_TRAVERSA L
wx.Panel.__init __(self, *args, **kwds)
self.frame = args[0]

MyMap = MakeActiveXClas s(MapPointMod.M appointControl,
eventObj=sel f)
self.window_1 = MyMap(self, -1)
self.window_1.O penMap("C:\\TEM P\\GPS_ON.ptt")
...
...
def OnBeforeClick(s elf, 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1196
by: cal_2pac | last post by:
Resurrecting a month old thread.. (listed at http://groups-beta.google.com/group/comp.lang.python/browse_thread/thread/2f4e50e1e316eef4/5924203f822f7f4b?q=cal_2pac&rnum=3#5924203f822f7f4b) Somehow - responses to that thread are not being brought up in chronological order. Thus the creation of another thread. The thread listed above proposed a solution to receive events from user events on the document in a webpage. However, it seems that...
3
2321
by: HL | last post by:
The requirement is to send some information to other objects. The objects to whom the information has to be sent is not available at compile time. The names of the types (objects) will be provided through an external file in which case we can use reflection to create objects of that type at run time. Case 1: The methods of those types can be invoked through reflection. Case 2: The caller can publish certain events. The types (objects)...
8
1773
by: Marcin Nowak | last post by:
Hi! I want to cancel up and down arrows in list (select) element. Here is the code: <script> function Arrows (event) { code = event.keyCode;
9
2653
by: redefined.horizons | last post by:
Here is another non-pythonic question from the Java Developer. (I beg for forgiveness...) Does Python have a mechanism for events/event-driven programming? I'm not necessarily talking about just GUIs either, I'm interested in using events for other parts of an application as well. If there isn't some sort of event mechanism built into Python, where might I find some information about implementing one?
2
1088
by: JohnR | last post by:
I know about AddHandler and RemoveHandler, but my requirement is a little more complex. I pass a form to a routine. In that routine I must scan each control, and for each "button" control I find, I must delete it's "click" event handler. I can't see how to do this using RemoveHandler because I don't know the name of the delegate handling the event. So, somehow, having just the control, I need to dynamically see if it's "click" event...
0
955
by: Oliver Nelson | last post by:
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):
0
1035
by: Oliver Nelson | last post by:
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):
0
788
by: Oliver Nelson | last post by:
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):
25
5159
bugboy
by: bugboy | last post by:
I'm trying to find a cross browser solution for editing text in a flickr photo caption manor where the text is displayed in a <div> or <a> tag but changes to a <textarea> via JS when clicked. There are two problems. 1. setting the focus on the new textarea 2. keeping the new text value when switching back to normal text. Firefox: focuses fine but does not keep the new text value Safari: focuses then instantly looses focus again, and...
0
7992
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8400
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8051
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6725
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5850
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5438
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3940
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2414
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1250
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.