vbAccelerator - Contents of code file: frmXButtonTest.frm

VERSION 5.00
Begin VB.Form frmXButtonTest 
   Caption         =   "Mouse XButton Click Sample"
   ClientHeight    =   5265
   ClientLeft      =   3960
   ClientTop       =   2055
   ClientWidth     =   6585
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmXButtonTest.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   5265
   ScaleWidth      =   6585
   Begin VB.CommandButton cmdNewWindow 
      Caption         =   "&New"
      Height          =   375
      Left            =   4800
      TabIndex        =   5
      Top             =   120
      Width           =   1455
   End
   Begin VB.OptionButton optDetectStyle 
      Caption         =   "Do not &detect"
      Height          =   255
      Index           =   2
      Left            =   600
      TabIndex        =   3
      Top             =   960
      Width           =   4335
   End
   Begin VB.OptionButton optDetectStyle 
      Caption         =   "On &form only"
      Height          =   255
      Index           =   1
      Left            =   600
      TabIndex        =   2
      Top             =   660
      Width           =   4335
   End
   Begin VB.OptionButton optDetectStyle 
      Caption         =   "Any&where in this form"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   600
      TabIndex        =   1
      Top             =   360
      Value           =   -1  'True
      Width           =   4335
   End
   Begin VB.ListBox lstEvents 
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2985
      Left            =   240
      TabIndex        =   0
      Top             =   1380
      Width           =   6075
   End
   Begin VB.Label lblDetectStyle 
      Caption         =   "Detect XButton clicks:"
      Height          =   255
      Left            =   240
      TabIndex        =   4
      Top             =   120
      Width           =   6075
   End
End
Attribute VB_Name = "frmXButtonTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private WithEvents m_cXButton As cXButtonEvents
Attribute m_cXButton.VB_VarHelpID = -1

Private Sub LogEvent(ByVal sMsg As String)
   lstEvents.AddItem sMsg
   lstEvents.ListIndex = lstEvents.NewIndex
End Sub

Private Sub cmdNewWindow_Click()
   Dim f As New frmXButtonTest
   f.Move Me.left + 480, Me.top + 480
   f.Show
End Sub

Private Sub Form_Load()
   Set m_cXButton = New cXButtonEvents
   m_cXButton.Attach Me, True
End Sub

Private Sub Form_Resize()
   On Error Resume Next
   lstEvents.Move lstEvents.left, lstEvents.top, Me.ScaleWidth - lstEvents.left
    * 2, Me.ScaleHeight - lstEvents.top - lstEvents.left
End Sub

Private Sub m_cXButton_XBtnDblClick(Button As XMouseButtonConstants, Shift As
 ShiftConstants, x As Single, y As Single, bConsume As Boolean)
   LogEvent "XButtonDblClick: " & IIf(Button = XButton1, "XButton1 (Back)",
    "XButton2 (Forward)") & ", Shift=" & Shift & ", x=" & x & ", y=" & y
End Sub

Private Sub m_cXButton_XMouseDown(Button As XMouseButtonConstants, Shift As
 ShiftConstants, x As Single, y As Single, bConsume As Boolean)
   LogEvent "XButtonDown: " & IIf(Button = XButton1, "XButton1 (Back)",
    "XButton2 (Forward)") & ", Shift=" & Shift & ", x=" & x & ", y=" & y
End Sub

Private Sub m_cXButton_XMouseUp(Button As XMouseButtonConstants, Shift As
 ShiftConstants, x As Single, y As Single, bConsume As Boolean)
   LogEvent "XButtonUp: " & IIf(Button = XButton1, "XButton1 (Back)", "XButton2
    (Forward)") & ", Shift=" & Shift & ", x=" & x & ", y=" & y
End Sub

Private Sub optDetectStyle_Click(Index As Integer)
   Select Case Index
   Case 0
      m_cXButton.Attach Me, True
   Case 1
      m_cXButton.Attach Me
   Case 2
      m_cXButton.Detach
   End Select
End Sub