Double Click Custom Command Bar

G

Guest

Using XL2003.

I have custom command bar that I've attached to an add-in with different
procedures for each button (via the OnAction property). Everything works
fine, but I would like to add some more functionality so that if a user
double clicks on a button a different stream of code will run. Since you can
only associate one procedure with a command bar button (as far as I know), I
was hoping that there was some way to determine if the user single or double
clicked the button and then I could continue accordingly. For example (psuedo
code),

Sub CustomButton()
If SingleClick then
' Perform single click code
Elseif DoubleClick then
' Perform double click code
EndIf
End Sub

Any help would be greatly appreciated. Thanks in advance.

-Cory
 
J

Jim Rech

Since you can only associate one procedure with a command bar button (as
You're right and, come to think about it, what you're contemplating is
pretty non-standard. Can you think of any apps where double-clicking a menu
item results in a different action? OTOH some apps, like Excel, do have
different behaviors sometimes when the Shift key is held down during a
click. You might pursue that one.

Declare Function GetKeyState32 Lib "User32" Alias "GetKeyState" (ByVal vKey
As Integer) As Integer

Sub MyMenuHandler()
If ShiftDown Then
....
Else
....
End If

Function ShiftDown() As Boolean
ShiftDown = (GetKeyState32(16) < 0)
End Function

--
Jim
| Using XL2003.
|
| I have custom command bar that I've attached to an add-in with different
| procedures for each button (via the OnAction property). Everything works
| fine, but I would like to add some more functionality so that if a user
| double clicks on a button a different stream of code will run. Since you
can
| only associate one procedure with a command bar button (as far as I know),
I
| was hoping that there was some way to determine if the user single or
double
| clicked the button and then I could continue accordingly. For example
(psuedo
| code),
|
| Sub CustomButton()
| If SingleClick then
| ' Perform single click code
| Elseif DoubleClick then
| ' Perform double click code
| EndIf
| End Sub
|
| Any help would be greatly appreciated. Thanks in advance.
|
| -Cory
 
G

Guest

Jim - Thanks for the help. I'm going to hold out hope on the double clicking,
but will keep the Shift idea in mind.

The only double click menu example that I can think of would be the Format
Painter in either XL or Word. A single click will paste formats for only one
click and release of the mouse button. A double click allows you to
continously click and release the mouse button until the format painter is
turned off by a single click.

-Cory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top