Simulate clicking a toolbar button 
Author Message
 Simulate clicking a toolbar button
How can I call a Toolbar's ButtonClick procedure?

Prototype is:
Private Sub tbrMedia_ButtonClick(ByVal Button As MSComctlLib.Button)

I am trying:
tbrMedia_ButtonClick (tbrMedia.Buttons("pause"))

...and get "Type mismatch".

Eq.

--

Equinox Tetrachloride
www.cl4.org - www.insecurities.org



Thu, 14 Oct 2004 08:34:24 GMT  
 Simulate clicking a toolbar button
On Sun, 28 Apr 2002 00:34:24 +0000 (UTC), "Equinox Tetrachloride"

Quote:

>How can I call a Toolbar's ButtonClick procedure?

Option Explicit

' Set up the call like this..
Private Sub Command1_Click()
    Dim aBut As MSComctlLib.Button
    Set aBut = Toolbar1.Buttons(1)
    Call Toolbar1_ButtonClick(aBut)
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    MsgBox ("You called with " & Button.Caption & "?")
End Sub

Regards, Frank



Thu, 14 Oct 2004 14:01:33 GMT  
 Simulate clicking a toolbar button


Quote:
>On Sun, 28 Apr 2002 00:34:24 +0000 (UTC), "Equinox Tetrachloride"

>>How can I call a Toolbar's ButtonClick procedure?

On second thought this should work too.:
Call ToolBar1_ButtonClick(Toolbar1.Buttons(1))

I do prefer my first one though, it stands out a bit more in the code.

Regards, Frank



Thu, 14 Oct 2004 14:33:35 GMT  
 Simulate clicking a toolbar button

Quote:

> How can I call a Toolbar's ButtonClick procedure?
> [...] I am trying:
> tbrMedia_ButtonClick (tbrMedia.Buttons("pause"))

Pesky Call keyword, that's what I was missing :)

Eq.

--

Equinox Tetrachloride
www.cl4.org - www.insecurities.org



Thu, 14 Oct 2004 21:25:24 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Simulating toolbar button click through menu item?

2. VBScript for simulating clicking the stop button on IE toolbar

3. How to make a toolbar button click down/click up

4. simulating cmd button click event

5. Simulating button click

6. simulate a click with the left button in a listview

7. Simulate button click?

8. Code to simulate mouse button clicks

9. simulate click on a button ?

10. Simulating button-click events using code

11. Simulating clicking on the home button?

12. using code to simulate mouse button clicks

 

 
Powered by phpBB® Forum Software