RE: Win32lib problem
- Posted by Philip D. <philip1987 at hotmail.com> Dec 02, 2003
- 450 views
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}.