For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > February 2005 > Mouse click









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Mouse click
zonga

2005-02-18, 8:58 pm

I am new to VB6 and started learning.
I have three Picture box. A timer. What I wanted is when timer is running I
want mouse click false or disable. Here is my code which is not working and
error. Pls help Thanks in advance.
Private Sub Form_Load()
Timer1.Enabled = true
Picture1.Tag = App.Path & "\image\ant.bmp"

Picture1.Picture = LoadPicture(Picture1.Tag)
Picture2.Tag = App.Path & "\image\ant1.bmp"
Picture2.Picture = LoadPicture(Picture2.Tag)

Picture3.Tag = App.Path & "\image\ant2.bmp"
Picture3.Picture = LoadPicture(Picture3.Tag)

End Sub

Private Sub Picture3_Click()
If Timer1.Enabled = True Then
mouse clicked =false
Picture1.Tag = App.Path & "\image\ant4.bmp"
Picture1.Picture = LoadPicture(Picture1.Tag)
Else
beep
End If
End Sub

Private Sub timer1_Timer()
On Error Resume Next
ShowCursor 0
t = Timer
Do: DoEvents: Loop Until Timer > t + 3

ShowCursor 1
Timer1.Interval = 3second
End Sub

Larry Serflaten

2005-02-18, 8:58 pm


"zonga" <zonga@discussions.microsoft.com> wrote
> I am new to VB6 and started learning.
> I have three Picture box. A timer. What I wanted is when timer is running I
> want mouse click false or disable.


How about disabling the picture boxes when you enable the timer (and
vice versa)?

> Private Sub Form_Load()
> Timer1.Enabled = true


Picture1.Enabled = False
Picture2....
Picture3....

> Picture1.Tag = App.Path & "\image\ant.bmp"
> Picture1.Picture = LoadPicture(Picture1.Tag)
> Picture2.Tag = App.Path & "\image\ant1.bmp"
> Picture2.Picture = LoadPicture(Picture2.Tag)


etc...


FWIW:


> Private Sub timer1_Timer()
> On Error Resume Next
> ShowCursor 0
> t = Timer
> Do: DoEvents: Loop Until Timer > t + 3
>
> ShowCursor 1
> Timer1.Interval = 3second
> End Sub



Using the timer control is supposed to replace using a do-nothing
loop for a delay. Why add it back in?

Private Sub Timer1_Timer()
Static tick As Long

Timer1.Interval = 3000
tick = 1 - tick
ShowCursor tick

End Sub

HTH
LFS




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com