Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Coordinate's in the mouse up event
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00495285
Message ID:
00495303
Views:
13
>I am using the mouse up event in a shape to resize two grids (one on yhe top of the grid and one on the bottom). When the user clicks and drags the shape the grids will follow in whichever direction and resize as needed to stay within the container they reside in. However the nYcoord is not always accurate to where the mouse up is fired. Is there a conflict with the coordinate's in the container as compared to the form. Or might there be another method to do this someone wants to share?



In my application, everything is done in the MouseMove event of the object. It has the advantage (perhaps inconvenient on slow PCs) to take action while you are dragging the object. The object here is a container, probably because we simply thought about it first instead of the shape. Here's the code, slightly modified to take the junk out; we have 6 or 7 controls that resize or move, but I've just left 2: grdDT is the grid above and grdDTOuvert is the grid below.
LPARAMETERS nButton, nShift, nXCoord, nYCoord
IF nButton = 1    && Only if the left-mouse button is depressed (dragging)
    && Check to fit within a minimum and maximum range
    IF (nYCoord < ThisForm.Height - 95) AND nYCoord > ThisForm.grdDT.Top+60
        && Move the container
        THIS.Top = nYCoord

        && Resize the top control
        ThisForm.grdDt.Height = THIS.Top - THISFORM.grdDt.Top

        && Reposition the bottom control
        ThisForm.grdDtOuvert.Top = This.Top + This.Height

        && Resize the bottom control
        ThisForm.grdDtOuvert.Height = ThisForm.Height - This.Top - ;
            This.Height - 5
    ENDIF
ENDIF
Sorry about not having color-coded it; I don't have Mike Helland's little function at hand since I don't write code often!
Sylvain Demers
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform