Re: Win32lib problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

>> Derek Parnell wrote:
 >> >
 >> > Philip Deets wrote:
 >> >
 >> > >
 >> > > > >I'm making a programming editor with win32lib. I found a
 >> > > > >problem and simplified the program so that this program
 >> > > > >recreates the error. When you click on the child window, Eu
 >> > > > >shows the result of getMouseRelPos(). The problem is, when
 >> > > > >you click the top-left pixel of the child window,
 >> > > > >getMouseRelPos( child ) should return {1,1}; instead, it
 >> > > > >returns {1,-29}.  It seems that for the Y position, it
 >> > > > >returns the correct answer minus the width of the toolbar.
 >> > > >
 >> > > >I do not get this result. On my system, I get the *correct*
 >> > > >value of {0,0}.
 >> > > >
 >> > > >What version of win32lib are you using?
 >> > > 0.59.01
 >> > > >
 >> > > >What version of Windows are you using?
 >> > > Windows XP Pro sp1
 >> >
 >> >
 >> > I just used 0.59.2K (which is virtually the same for this
 >> > function), on Windows 2000 and it works just fine.
 >> >
 >> > > >Also, does the wrong value change if you change the toolbar
 >> > > >specifications?
 >> > > Yes, when I change the toolbar to 50 width, I get {0, -50}.
 >> >
 >> > Try this variation of your code. This shows clicks for all three
 >> > controls plus is shows the absolute position, the control's Top Left
 >> > absolute position and the mouse's relative position. All seem to work
 >> > okay on my systems.
 >> >
 >> > --source code
 >> >
 >> > without warning
 >> > include Win32Lib.ew
 >> >
 >> > constant win = create( Window, "win", 0, 0, 0, 300, 300, 0 ),
 >> >          tb = create( ToolBar, "", win, 0, 0, 0, 30, 0 ),
 >> >          child = create( Window, "", win, 50, 50, 100, 100, {WS_CHILD,
 >> >          WS_VISIBLE, WS_BORDER} )
 >> >
 >> > procedure click( integer self, integer event, sequence parms )
> > >     ? self & getPointerPos() & ClientToScreen(self, 0, 0) &
> > >     getPointerRelPos( self )
> > > end procedure
 >> > setHandler( {win,tb,child}, w32HClick,  routine_id("click") )
 >> >
 >> > WinMain( win, Normal )
 >> >
 >> > --
 >> > Derek
 >> >
> > >
> > I get {17,55,111,55,111,0,-30}.
> >
>
>Found it! There was a bug in the old version (the one you are using) of 
>getPointerRelPosition(). >You can fix it quickly by going to this function 
>inside win32lib and changing the call >to "getClientPoint" to 
>"ClientToScreen". It uses the same parameters.
>
>--
>Derek

Thanks a lot!  Is the newer version available yet?

Phil

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu