[python-win32] Canceling OnBeforeClick event in MapPoint 2006
Tim Roberts
timr at probo.com
Tue Aug 28 20:07:01 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#).
>
> I've tried working with the calendar control and have successfully
> canceled the BeforeUpdate event using the same line. The only
> difference I can see between the two is that the calendar control is
> using a short for the cancel param while mappoint is using a bool. I'm
> using early binding btw.
>
The list of types that are valid in an IDL file to be used with COM
automation is very limited; the C++ "bool" type is not on that list. If
this were an IDL that you controlled, you could change it to "long *".
The MIDL spec defines a "Boolean" type, but that's an 8-bit type that
isn't compatible with COM automation.
http://msdn2.microsoft.com/en-us/library/aa367090.aspx
If this is really an IDL that shipped with MapPoint, then I'd call that
a Microsoft bug.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list