Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mouse Pointer Problems

Status
Not open for further replies.

ogri

Programmer
Joined
Sep 26, 2000
Messages
74
Location
GB
Hi

I have a pair of forms that are having problems with the mouse pointer. The first form loads and triggers a logon form. When the user enters the logon details they can either press return or click on the Logon button. One of the first things done is to set the mouse pointer to the hourglass.

However, this is where the fun starts. If the user clicks on the Logon button, or the mouse pointer is over the form when the user presses return then the mouse pointer changes fine. If the mouse pointer is outside the form then it does not change.

I have added several "Do Events" to no effect, and tried using refresh as well. I have tried setting the mousepointer using me.Mousepointer, frmFormName.Mousepointer and screen.Mousepointer, all to no effect.

Any ideas? I know it isnt a serious problem but it just looks tatty and bugs me

All the best

Keith
 
Try this:
On the background form
Code:
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.MousePointer = vbDefault
End Sub
Let me know if this helps

If you are worried about posting, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Typically, you would load the sign-on form as a modal form:

Main Form:

Private Sub Form_Load()
LogOn.Show vbModal
Me.MousePointer = vbHourGlass

'Some Code

'Everything Done
Me.MousePointer = vbDefault

End Sub

Better would be to use a Start up Sub in a Module, and set that as the start up proceedure under PROJECT|PROPERTIES:

Module1

Private Sub Main()

LogOn.Show vbModal
Me.MousePointer = vbHourGlass

'Some Code

MainForm.Show

'More Code if needed

Me.MousePointer = vbDefault

End Sub


You could also do this:

Private Sub Form_Load()
Me.MousePointer = vbHourGlass
End Sub

Private Sub Form_Activate()
Me.MousePointer = vbDefault
End Sub
 
Hi

Thanks for those, but I cannot see how they will fix this problem.

What do you mean by the "Background Form"? One form is loaded and the Form Load event loads and displays the second form (with the first one not visable at that stage).

The problem is that if the mouse pointer is outside the boundary of the displayed form (which just being a userid / password / environment is only taking up maybe 10% of the screen) when the user presses the "Logon" button then the mouse pointer does not change to the hourglass. This is fair enough while the mousepointer is outside the displayed form, but if you move the mousepointer over the displayed form while it is busy processing the request to log on it still does not update the displayed mouse pointer to the hourglass

All the best

Keith
 
The log-on process may be tying up the system. This is one of the cases where DoEvents comes in handy - add it right after setting the mouse. *******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Hi

Tried both DoEvents and Me.Refresh immediatly after setting the mouse pointers, but the Logon code is all in a DLL that I cannot easily touch.

Doesnt look like there is a way round it [sadeyes]

All the best

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top