ControlDragging was: Re: [lazarus] CVS Changes

Marc Weustink weus at quicknet.nl
Wed Jun 14 16:48:21 EDT 2000


At 13:30 14-06-2000 -0500, Shane Miller wrote:


>Press the NEW FORM button.
>Select the Button component and drop it onto the form.
>Drag the button 2 pixels up.  It probably moved a little.  Now do it again.
>It doesn't work.
>If you look at the output (look at designerform.pp in mousedown and mouseup
>to see what SHOULD be displayed)  you'll see that the TOP and LEFT seem to
>be reported incorrectly.
>If you MOVE the form then try it again it's reported correctly.
>This also occurs when trying to place controls onto the form.  Sometimes
>they appear correctly, sometimes not.
>When they dont you can move the form and thn the  next one appears
>correctly.
>
>Any ideas?

Mouse.Cursorpos is given in screen coordinates, not in form coordinates.
Onmousedown you store Cursorpos (or better, the given X and Y),
onmouseUp you calc the difference with the new Cursorpos (or better, the 
given X and Y) THe difference is added to the Left and Top.

I committed a solution which normally should work, however it doesn't due 
to a bug in the MouseMove and MouseUp handlers

MouseMove / MouseUp should always give the mouseposition X and Y in the 
Sender coordinates.  It does as long as the up event occoured in the 
control itself. However if you are outside the control you get the X and Y 
in Form coordinates.

Marc







More information about the Lazarus mailing list