[python-win32] Re: Canceling OnBeforeClick event in MapPoint 2006

Roger Upole rwupole at msn.com
Wed Aug 29 04:48:46 CEST 2007


Oliver T. Nelson wrote:
> Some of you may have read this post over on the forums or wx mailing 
> list, I'm hoping I can find someone that has gone through this problem 
> already.  Canceling this event in other languages seems to work just 
> fine, but in python it doesn't work.
> 
> The IDL for the function is:
> 
> void BeforeClick(long Button, long Shift, long X, long Y, bool* Cancel)
> 
> Based on this I've tried canceling the event by:
> 
> return 0, True
> 
> So that the byref cancel param gets set to true which should cancel the 
> click event (works in c#).

Only output parameters should be returned.  Try just

return True

It would be helpful if the makepy generated event prototypes indicated which
parms are treated as output, something like:

#    def OnSomethingOrOther(self, arg1=defaultNamedNotOptArg, arg2=defaultNamedNotOptArg, arg3=defaultNamedNotOptArg):
#         return arg3

I might try to implement that when I have some time.

        Roger



More information about the python-win32 mailing list