Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Screen coordinates of mouse position?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00258766
Message ID:
00259292
Views:
27
>>Thanks for your reply. I don't think that will work. I should have been given a more complete description of what I am doing. I want to make a top level form moveable without a standard windows title bar. I want to be able to click on a portion of the form and drag the entire form around the windows desktop. I think can do it in the mouse down event and looping while MDOWN() if I know the absolute mouse coordinates within the windows desktop. This is the code I am using that almost works:
>>
>>LPARAMETERS nButton, nShift, nXCoord, nYCoord
>>LOCAL lnLastMrow, lnLastMCol
>>IF nButton = 1
>> lnLastMrow = MROW("",3)
>> lnLastMCol = MCOL("",3)
>> DO WHILE MDOWN()
>> ThisForm.Top = ThisForm.Top + (MROW("",3) - lnLastMrow)
>> ThisForm.Left = ThisForm.Left + (MCOL("",3) - lnLastMcol)
>>
>> lnLastMrow = MROW("",3)
>> lnLastMCol = MCOL("",3)
>> ENDDO
>>ENDIF
>
>Hi Ivan,
>
>My suggestion won't work in VFP 5.0 were you had to remove the caption in order to get a form without a title bar. In 6.0 you just set the TitleBar property to 0. It still has a caption, which can be used to get the window handle you need to call _GetWRect().
>
>However, it may not be necessary to use Foxtools. A top level form's Top and Left properties should be absolute to the desktop. MROW() and MCOL() should return the relative position of the mouse to the form.
>
>Perhaps more info is needed here. So let me ask you what's not working right in your code sample?

Thanks for looking at my code. You comment made me take a another look at it and I found the problem. The following code works:
LOCAL lnLastMrow, lnLastMCol, lnNewMrow, lnNewMCol

IF nButton = 1
lnLastMrow = MROW("",3)
lnLastMCol = MCOL("",3)

DO WHILE MDOWN() AND MROW("",3) > 0 AND MCOL("",3) > 0
lnNewMrow = MROW("",3)
lnNewMCol = MCOL("",3)

ThisForm.Top = ThisForm.Top + (lnNewMrow - lnLastMrow)
ThisForm.Left = ThisForm.Left + (lnNewMcol - lnLastMcol)

lnLastMrow = lnNewMrow
lnLastMCol = lnNewMcol
ENDDO
ENDIF

The multiple calls within the do while to MROW() and MCOL() apparently were causing the wierd behavior.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform