ButtonClick, ButtonDblClick Events

Purpose

Occurs when the user clicks or double clicks on a Button object in a Toolbar control.

Syntax

Sub object_ButtonClick(btn As Button)

Sub object_ButtonDblClick(btn As Button)

object: ToolBar Ocx

Description

To program an individual Button object's response to the ButtonClick event, use the value of the btn argument. For example, use the Key property of the Button object to determine the appropriate action.

Example

Ocx ToolBar tlb

tlb.Add , "open" , "Open"

tlb.Add , "save" , "Save"

Do : Sleep : Until Me Is Nothing

 

Sub tlb_ButtonClick(Btn As Button)

Switch Btn.Index

Case 1 : Message("Open Button") // open

Case 2 : Message("Save Button") // save

EndSwitch

EndSub

 

Sub tlb_ButtonDblClick(Btn As Button)

Trace Btn

Switch Btn.Key

Case "open" : Message("Open DClick")

Case "save" : Message("Save DClick")

EndSwitch

EndSub

Remarks

When afterwards a Button is inserted, the Index property might lose its original value. Therefore, it is often better to use the Key property, which uniquely identifies a button.

See Also

ToolBar

{Created by Sjouke Hamstra; Last updated: 24/09/2014 by James Gaite}