Moving a control with the mouse at runtime



I assumed this would be a really easy challenge, but VB6 doesn't seem to
want to play.

Very simply I tried the following:
on mousedown event capture existing x and y
on mousemove event calculate the delta and move the control this
distance and store the new x and y

This simply doesn't work.
First, moving a control under a stationary mouse generates a mouse moved
event! (I checked this with a control on the form moved using a timer.
Place the cursor over it and watch movemove events appear)
Second something is wrong in the world of twips, or the reported twips
returned by the mousemove event. The mouse pointer gets further and
further from the control being dragged.
I'm thinking perhaps using the win32api to get the exact mouse cursor
position, but I imagine that will have problems translating to an in
container position.

Any help would be appreciated.







*** Sent via Developersdex http://www.developersdex.com ***
.



Relevant Pages

  • Re: speech recognition & e-mail messages probs !!!
    ... To answer your question about mouse control and cursor control with ... say that is because I correspond regularly with someone who uses DNS ... cursor with voice control. ... speech recognition solutions and support. ...
    (microsoft.public.windows.vista.general)
  • Re: Moving a control with the mouse at runtime
    ... moving a control under a stationary mouse generates a mouse moved ... > Second something is wrong in the world of twips, or the reported twips ... > I'm thinking perhaps using the win32api to get the exact mouse cursor ... > container position. ...
    (microsoft.public.vb.general.discussion)
  • Re: Positioning Cursor
    ... i do mean do set the position of the cursor. ... On a Form I have a Control, positioned let's say at 4 cm from the ... 7th or 8th entry in the list although no entry is ... ' If LeaveFocus is True, the focus will be returned to ...
    (microsoft.public.access.modulesdaovba)
  • Re: Documentation, anyone?
    ... password field and a "submit" button, and if the user hits the key ... Nope..actually the "enter" event is when the cursor moves into the ... control/field. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Raw Input from Mouse-like HID device
    ... DIEDFL_INCLUDEALIASES, I get 3 mice and 3 keyboards, whether my USB HID ... work fine when controlling the cursor normally. ... However, I want the touchscreen to control the cursor, but the control ... I have even tried a nasty kludge using raw input, ...
    (microsoft.public.development.device.drivers)