|
-
Aug 3rd, 2005, 09:18 PM
#1
Thread Starter
Member
Command1 doubleclick event???
question 1: how can i make command1 to have a doubleclick event?
question 2: is there a way to highlight command1 like what windows does when you click on an icon?
-
Aug 3rd, 2005, 09:20 PM
#2
Fanatic Member
Re: Command1 doubleclick event???
Highlight? You mean like when the command button has tab focus?
-
Aug 3rd, 2005, 09:21 PM
#3
Re: Command1 doubleclick event???
 Originally Posted by vbcooler
question 1: how can i make command1 to have a doubleclick event?
question 2: is there a way to highlight command1 like what windows does when you click on an icon?
Save the Timer variable, and if it is less than 5ms away, then count a second cick.
You can change the color of the command button.
-
Aug 3rd, 2005, 09:24 PM
#4
Thread Starter
Member
Re: Command1 doubleclick event???
can you please give me an exmaple in code or as an attachment?
-
Aug 3rd, 2005, 09:25 PM
#5
Lively Member
Re: Command1 doubleclick event???
Do you need to use a command button?
If you use somthing like a label it has a DblClick function built in.
Hojo
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
Aug 3rd, 2005, 09:28 PM
#6
Thread Starter
Member
Re: Command1 doubleclick event???
THx Hojo, you solved my first question
but i stil want to know if there is a way to make label1 highlight if like if you go to your windows desktop and click only once on any icon it will amke is highlighted in blue
-
Aug 3rd, 2005, 09:29 PM
#7
Re: Command1 doubleclick event???
Exactly HOJO! - use Label control or Image control or ... but why going through so much troubles - I don't get it.
-
Aug 3rd, 2005, 09:29 PM
#8
Re: Command1 doubleclick event???
Suggestion: Use a PictureBox; that has a DblClick Event. You could change the text/picture it displays when the mouse moves over it.
Bruce.
-
Aug 3rd, 2005, 09:36 PM
#9
Re: Command1 doubleclick event???
Alternatly, have a look at post #6 from this (old) thread: http://www.vbforums.com/showthread.p...ighlight=lable
And,
a simple way (with a Label for example) change the text/background colour etc in the Lables Mouse_Move Event, then reset it when the Mouse moves on the Form.
To do that use the Form's MouseMove_Event; but use a Boolean (Flag) Variable so your not
always cycling the Lable as the Mouse moves over the Form. Yes, the evaluation of the Flag is taking place but thats it. Sooo the method above may be better 
Bruce.
-
Aug 3rd, 2005, 09:47 PM
#10
Thread Starter
Member
Re: Command1 doubleclick event???
How Do I Do Muse Over Event?
-
Aug 3rd, 2005, 10:14 PM
#11
Re: Command1 doubleclick event???
Here is a sample that changes the color of a button. You can use the same for almost any control.
http://vbforums.com/attachment.php?attachmentid=37991
-
Aug 3rd, 2005, 10:19 PM
#12
Re: Command1 doubleclick event???
Place a Lable on a Form and paste the code for a demo:
VB Code:
Option Explicit
Dim blnToggleColour As Boolean
Private Sub Label1_DblClick()
'Whatever
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnToggleColour = False Then
Me.Label1.BackColor = vbRed
'Set the Flag
blnToggleColour = True
End If
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If blnToggleColour = True Then
Label1.BackColor = &H8000000F 'Default colour
'Reset the Flag
blnToggleColour = False
End If
End Sub
Please note that this method isn't bullet proof...
Bruce.
-
Aug 3rd, 2005, 10:33 PM
#13
Lively Member
Re: Command1 doubleclick event???
Here is a way to possible get what you want.
Use a textbox as a control
Set its backcolour to "button face"
Set its border to none
Set its appearence to flat and
set its locked property to true
Now you have created a label but a label with a dblclick function a gotfocus function and a lostfocus function then code like so...
VB Code:
Private Sub Text1_GotFocus()
Text1.BackColor = vbBlue ' or what ever colour you want
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = &H8000000F 'Button face colour
End Sub
Private sub Text1_dblClick()
'do whatever
End sub
Hope this helps
Hojo
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
Aug 3rd, 2005, 11:01 PM
#14
Re: Command1 doubleclick event???
Hojo,
The only problem with that example is the Text1.BackColor stays until the user 'clicks' on another control!
(Point: LostFocus isn't fired when the Mouse moves off the TextBox)
Bruce.
-
Aug 3rd, 2005, 11:37 PM
#15
Lively Member
Re: Command1 doubleclick event???
Isn't that what vbCooler wants?
Like with the icons in windows? They highlight when single click and stay highlighted until somthing else is clicked.
???
Despite body and mind, my youth will never die!
Everytime I learn something new it pushes some old stuff out of my brain!
-
Aug 3rd, 2005, 11:43 PM
#16
Re: Command1 doubleclick event???
Hojo: You might be right, since I re-read Q2 in post #1 
Bruce.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|