For Programmers: Free Programming Magazines  


Home > Archive > PowerBuilder > March 2004 > SetCapture(Parent)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SetCapture(Parent)
Zog

2004-03-27, 12:22 am

I coded my "mouse_leave" event and have a couple of problems. Shown
below is my code.

First, some background. I have a UODW that sits on a tab. The tab sits
on a window. Currently I am dragging the mouse over a UODW and firing
off the code in the descendant of this UODW.

I have SetCapture and ReleaseCapture defined as "user32.dll" on my
UODW for now, in my Local External Functions.


When I use "SetCapture( Handle( Parent ) )", the application locks up
in a very big way. Why is this doing this?

My second problem is xpos and ypos. Even though I convert xpos(ypos)
to Units using PixelsToUnits, the xpos and ypos when dragged over the
UODW start referencing at zero. For example, drag the mouse accross
the UO's leftmost border, the xpos shows zero units, than increases
dramatically to a value several times larger than the actual UO.

For example, if my UO has width of 1111 and height of 196, my
xpos(ypos) will have max values of 5056 and 768 respectively.

In additionally, the other pieces of my code, like (This.x) and
(This.x + This.width) will correctly display the PB Units where this
UO has been dropped on the tab. That works fine. The error seems to
come from xpos(ypos). It's as if the pointer has no idea where it is,
and what units its using.

Anybody ever encounter this?

Zog


IF NOT ibCaptured THEN
SetCapture( Handle( this ) )
//SetCapture( Handle( Parent ) )
ibCaptured = TRUE
This.trigger event ue_mouse_in()
ELSE
Xpointer = PixelsToUnits(xpos, XPixelsToUnits!)
Ypointer = PixelsToUnits(ypos, YPixelsToUnits!)
IF Xpointer < (This.x) OR &
Xpointer > (This.x + This.width) OR &
Ypointer < (This.y) OR &
Ypointer > (This.y + This.height) THEN

llx = string(This.x)
llxx = string(This.x + This.width)
lly = string(This.y)
llyy = string(This.y + This.height)
This.object.LabelA[1] = 'X:'+string(Xpointer)+' ['+ llx +', '+ llxx
+']'
This.object.LabelB[1] = 'Y:'+string(Ypointer)+' ['+ lly +', '+ llyy
+']'

IF ReleaseCapture() THEN
ibCaptured = FALSE
This.trigger event ue_mouse_out()
END IF
END IF
END IF
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com