 |
 |

10-09-2006, 04:36 PM
|
|
Newcomer
|
|
Join Date: Aug 2003
Posts: 11
|
|
Clicking Command Button Twice...
|
Hi, I am looking for a way to see if a user has clicked a command button twice, and then if so I would like to disable the command button..
Private Sub btn_equipment_Click(Index As Integer)
Dim tmpFlash, tmpSmoke As String
tmpFlash = 0 'Flash click counter starts at zero.
tmpSmoke = 0 'Smoke click counter starts at zero.
If btn_equipment(2) Then 'If btn_equipment(2) is clicked then.
tmpFlash = tmpFlash + 1 'Add 1 to tmpFlash
If tmpFlash >= 2 Then 'Check to see if command button has been clicked twice.
btn_equipment(2).Enabled = False 'Disable command button.
Else
btn_equipment(2).Enabled = True 'Enable command button
End If
Debug.Print
End If
Debug.Print btn_equipment(Index).Tag
End Sub
|
|

10-09-2006, 04:38 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
Static tmpFlash As String, tmpSmoke As String
|
__________________
~ Quod non mortiferum, fortiorem me facit ~
Avatar by lebb
|

10-09-2006, 04:40 PM
|
|
Newcomer
|
|
Join Date: Aug 2003
Posts: 11
|
|
Quote:
|
Originally Posted by reboot
Static tmpFlash As String, tmpSmoke As String
|
I tryed doing that but it is not working...
Private Sub btn_equipment_Click(Index As Integer)
Static tmpFlash, tmpSmoke As String
tmpFlash = 0 'Flash click counter starts at zero.
tmpSmoke = 0 'Smoke click counter starts at zero.
and also I am getting an error on this line...
If btn_equipment(2) Then 'If btn_equipment(2) is clicked then.
ALSO it is not adding 1 to tmpFlash
|
|

10-09-2006, 04:41 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
ok well, if you set them back to 0 each time, how is it ever going to get to 2?
|
__________________
~ Quod non mortiferum, fortiorem me facit ~
Avatar by lebb
|

10-09-2006, 04:42 PM
|
|
Newcomer
|
|
Join Date: Aug 2003
Posts: 11
|
|
Quote:
|
Originally Posted by reboot
ok well, if you set them back to 0 each time, how is it ever going to get to 2?
|
How do i make it so it does not reset to zero?
|
|

10-09-2006, 04:53 PM
|
 |
Keeper of foo
Retired Moderator * Guru *
|
|
Join Date: Nov 2001
Location: Graceland
Posts: 15,612
|
|
|
Oh I don't know... maybe take out the tmpFlash = 0 line?
|
__________________
~ Quod non mortiferum, fortiorem me facit ~
Avatar by lebb
|

10-09-2006, 06:51 PM
|
|
Contributor
|
|
Join Date: Sep 2005
Posts: 565
|
|
you can rewrite the code as follow
Code:
Private Sub btn_equipment_Click(Index As Integer)
Static tmpFlash As Integer
Static tmpSmoke As Integer
If Index = 2 Then
tmpFlash = (tmpFlash + 1) Mod 2
btn_equipment(2).Enabled = tmpFlash
End If
End Sub
the command button disabled when clicked towice even if the period between the 2 clicks is too long, but if you want it work as double click behaviour, this is another story 
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|