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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mousepointer conflict

Status
Not open for further replies.

jbrowne

Programmer
Feb 1, 2000
182
IE
Hi,

I've a silly little problem really but its doing my head in.
I'm running a large number of batch files one after the other from the click event of an "run" button. The process can take up to 10 minutes so I need a cancel button to interupt the run button if needs be. Now I am also running a progress bar to show how the batches are progressing after the "run " button is clicked. The progress bar turns my mousepointer to an eggtimer and while my cancel button works now, in that it will interupt the run button - to click it, I am clicking while I've still got an eggtimer mouse. It is functional but obviouly not practical to expect a user to click while an eggtimer is shown. so my question is - how do I interupt the eggtimer if the user hovers the mouse anywhere over the cancel button - but if they move off it again I need to go back to the eggtimer.
I hope I've made this clear and would appreciate any suggestions.

John B
 
Hi JBrowne! There may be an alternate short solution, but check it too

Set mouse pointer to normal on button mouse over event
and set mouse pointer to back eggtimer on form mouse over if bar is still in progress.

'For Example

Private Sub cmdCancel_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Form1.MousePointer = vbNormal
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If PBar1.Value>0 and PBar1.Value<100 Then
Form1.MousePointer = vbHourglass
End If
End Sub
 
You could use the MouseMove event on the control, and use screen.mousepointer to reset the pointer.

The main problem with that though is the number of times the event will be fired - every little movement of the mouse over the control...

Mmilan
 
tekfan - there is no MouseOver event for Command Buttons.

mmilan
 
mmilan thanks for correction! It was my writing mistake.I mean MouseMove events of Command Button and Form.
 
Thanks for the suggestions guys but I'm still having trouble. The batch files are running a java compiler which is using a lot of machine memory and as mmilan said, to put code in the mousemove events seems to use a lot of processor memory too and its just not able to deal with it all - I may have to go with leaving the mouse at default and disabling everything else on the form except the cancel button. Its crud but I can't see any other way - what do ye think?
 
You could think about having a boolean variable at form level, and setting it (using the mousemove event) true when you're over the control, and false when you're not (using the form's mousemove).

All you need to do then is check whether or not you are changing the value of the boolean - if you are, you've just "crossed the border" and can act appropriately.

mmilan
 
I was actually doing exactly that but the problem still is that while I am calling the java compiler - because memory usage is so intense - the vb program is not acting quick enough to repond in time to the mousemove events - thus I am moving over the button and away again and maybe 2 to 3 seconds later teh mouse changes - or not. Basically it seems to need all available memory for the java compiler and is slow to react to anything else.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top