mouse repositioning

T

ToddP

I'm running some code from an image_click event. All works fine except the
mouse curser jumps way to the right upon completion of the code. I want the
curser to remain fixed in its position without having to manually reposition
for future clicks. Any help?
 
T

ToddP

Excellent question! It got me thinking some more and I discovered the
reason. My mouse is set to 'Snap To'. The pointer is snapping to the next
focused command button. During the execution of the code, a brief flash of
some dialog box appears, stealing the pointer and leaving it there. I'm
uncertain what this dialog box is...I suspect it has to do with fetching the
new image file. Turning off the 'Snap To' feature in the mouse driver solves
the problem. However, this is not a preferred solution since I can't predict
if another user will have the same feature turned on.

Is there a way to temporary defeat the 'Snap To' feature of the mouse?

One solution I'd like to try is simply capturing the x,y coordinates of the
pointer with the On_Mouse_Down event and then assign these back somehow as
the last line of code in the ComboB1_AfterUpdate(). Problem is I can't find
any methods to move the pointer from code.

Here is the current code. Each click will sequence through an unbound combo
box query, update the image Picture property .gif file and a compute results
in a textbox.
Here is the code:

--------------------------------------------------------
Option Compare Database
Option Explicit
Public iB1 As Integer
----------------------------------------------------
Private Sub ImageB1_Click()

If iB1 < 10 Then
iB1 = iB1 + 1
Else
iB1 = 1
End If

ComboB1_AfterUpdate

End Sub
---------------------------------------------------------
Private Sub ComboB1_AfterUpdate()
Dim path As String
Dim fName As String
path = CurrentProject.path
fName = "Pic\" & Me.ComboB1.Column(2, iB1)

Me.ImageB1.Picture = path & "\" & fName
Me.TextVal = (Me.ComboB1.Column(1, iB1) & _
Me.ComboB2.Column(1, Me.ComboB2.ListIndex + 1)) * _
Me.ComboB3.Column(1, Me.ComboB3.ListIndex + 1)
Me.TextHT = (Me.TextVal * Me.ComboB4.Column(3,
Me.ComboB4.ListIndex)) + Me.TextVal
Me.TextLT = Me.TextVal - (Me.TextVal * Me.ComboB4.Column(3,
Me.ComboB4.ListIndex))
Me.CmdRefresh.Enabled = True
Me.ComboB1 = Me.ComboB1.Column(0, iB1)
End Sub
 
M

MacDermott

So you want focus to stay in the combobox?
One approach would be to use BeforeUpdate instead of AfterUpdate, and end
with Cancel=True.
Of course, that might make it harder for you to ever leave the combobox...
 
T

ToddP

The mouse point needs to remain on the image, to allow the user to continue
clicking until they get to the image they need. The combo box and text box
are sync'd and updated with each click. Focus is not required on the combo
box.
 
Top