473,886 Members | 2,519 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 1334

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
1893
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
1376
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
2784
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
1746
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
1625
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
2159
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
4084
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
4912
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
9956
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
9799
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
10770
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
10872
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
10429
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...
0
9592
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...
0
5808
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...
0
6010
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4627
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

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.