Re: setMousePointer bug
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 18, 2002
- 557 views
This was a mistake in win32lib. I have fixed it. In fact, there is a new routine that might be of use to you... procedure onMouse_Main( integer event, integer x, integer y, integer shift ) if event = LeftDown then setMousePointer( Main, SizeNSPointer ) elsif event = RightDown then setMousePointer( Main, SizeWEPointer ) elsif event = LeftUp then restoreMousePointer( Main ) elsif event = RightUp then restorePointer( Main) end if end procedure How the library will work now is that each call to setMousePointer places the existing pointer on a stack. The restoreMousePointer call pops the stack thus restoring whatever was the previous value. In fact, a call to setMousePointer(x, NULL) will be equivalent to a call to restoreMousePointer(x). To avoid an issue with programs continually setting the pointer and never restoring it, I've limited the size of the mouse stack to 20 items. But generally speaking, each setMousePointer call should have a corresponding restoreMousePointer call. All pointers are automatically restored when the program closes. 19/09/2002 1:18:40 PM, g.haberek at comcast.net wrote: > > > To: EUforum <EUforum at topica.com> > > From: g.haberek at comcast.net > Subject:setMousePointer bug > Date: Wed, 18 Sep 2002 20:18:40 -0700 > > > > i found a bug (using Don Phillips' VSplitter control) in setMousePointer() > when you set the mouse pointer to NULL or 0, the program crashes via > kernel32.dll. go a head try it, here's my code: > > > -- begin code > include win32lib.ew > without warning > > constant Main = create( Window, "Left click or right Click to change pointer > > (Right crashes!)", 0, Default, Default, .6, .6, 0 ) > > procedure onMouse_Main( integer event, integer x, integer y, integer shift ) > > if event = LeftDown then > setMousePointer( Main, SizeNSPointer ) > > elsif event = RightDown then > setMousePointer( Main, SizeWEPointer ) > elsif event = LeftUp then > setMousePointer( Main, ArrowPointer ) > > elsif event = RightUp then > setMousePointer( Main, NULL ) > end if > > end procedure > > onMouse[ Main ] = routine_id( "onMouse_Main" ) > > WinMain( Main, Normal ) > -- end code > > An easy fix is to reset the pointer to ArrowPointer, but I would still like > > to know, is this a Win32Lib error or relly a kernel32.dll error? > > ~Greg > > > > > --------- Cheers, Derek Parnell ICQ# 7647806