473,671 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.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
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(s elf, 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.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

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
1877
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. One of the main problems at this point lies in cancelling the event. I have found that the TAB fires the onkeypress in NN, but not in IE. I can cancel the onkeypress fine in NN. The TAB fires the onkeydown in IE and can be cancelled in IE. ...
16
1359
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. That would enable the simple test: var ref = new someObject(); if( ref ) { // Object created successfully }
7
2769
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 with the last value it had before the user changed it. Pretty typical Now, the user types some invalid value and clicks OK. The user gets a message saying the value is not valid, and the bad value is replaced with the last good one. So far, so...
0
1739
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 GiveFeedback
6
1619
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. This form does things like setup event handlers on each control so that
1
211
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
2147
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" then a GridView opens up and they can then select a record to view the record in the FormView. If they select the "NewRecord" LinkButton, the same FormView opens in Insert mode. The problem that I am having is that when the user clicks the...
9
4039
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 iframe. CODE ===== <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en_US"
1
4895
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 events when click on that date that perticular event displyed in a text box.But my requirement is to when click on that date that related event displyed in same td row not the text box. and also i add the events to that calendar.plz advice how to...
0
8390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8909
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
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...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
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
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2806
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
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
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.