vbAccelerator - Contents of code file: frmTestFindReplace.frmVERSION 5.00
Begin VB.Form frmTestFindReplace
Caption = "Test Find & Replace Dialogs"
ClientHeight = 5010
ClientLeft = 2640
ClientTop = 3090
ClientWidth = 7290
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "frmTestFindReplace.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5010
ScaleWidth = 7290
Begin VB.TextBox txtSample
Height = 2415
HideSelection = 0 'False
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 4
Text = "frmTestFindReplace.frx":1272
Top = 360
Width = 7035
End
Begin VB.CommandButton cmdReplace
Caption = "&Replace"
Height = 435
Left = 1680
TabIndex = 2
Top = 2820
Width = 1455
End
Begin VB.ListBox lstLog
Height = 1230
Left = 120
TabIndex = 1
Top = 3660
Width = 7035
End
Begin VB.CommandButton cmdFind
Caption = "&Find"
Height = 435
Left = 180
TabIndex = 0
Top = 2820
Width = 1455
End
Begin VB.Label lblSampleText
Caption = "&Sample Text"
Height = 195
Left = 120
TabIndex = 5
Top = 120
Width = 4095
End
Begin VB.Label lblEvents
Caption = "&Events:"
Height = 195
Left = 180
TabIndex = 3
Top = 3420
Width = 6915
End
End
Attribute VB_Name = "frmTestFindReplace"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private WithEvents m_cFR As cFindReplace
Attribute m_cFR.VB_VarHelpID = -1
Private Sub LogEvent(ByVal sMsg As String)
lstLog.AddItem sMsg
lstLog.ListIndex = lstLog.NewIndex
End Sub
Private Sub cmdFind_Click()
m_cFR.VBFindText Me.hWnd, "vbAccelerator"
End Sub
Private Sub cmdReplace_Click()
m_cFR.VBReplaceText Me.hWnd, "vbAccelerator", "Change"
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Debug.Print "KeyDown"
End Sub
Private Sub Form_Load()
' Create instance of Find/Replace object
Set m_cFR = New cFindReplace
' Load some sample text:
Dim sBuf As String
sBuf = txtSample.Text & vbCrLf
Dim ctl As Control
sBuf = sBuf & "Form: " & Me.Name & ", " & Me.Caption
For Each ctl In Me.Controls
On Error Resume Next
sBuf = sBuf & vbCrLf & vbTab & "Control: " & ctl.Name
Select Case TypeName(ctl)
Case "CommandButton", "Label"
sBuf = sBuf & " '" & ctl.Caption & "'"
Case "TextBox"
sBuf = sBuf & " '" & ctl.Text & "'"
End Select
Next
txtSample.Text = sBuf
End Sub
Private Sub Form_Resize()
On Error Resume Next
txtSample.Width = Me.ScaleWidth - txtSample.Left * 2
lstLog.Width = Me.ScaleWidth - lstLog.Left * 2
End Sub
Private Sub m_cFR_FindNext(ByVal sToFind As String, ByVal eFlags As
EFindReplaceFlags)
LogEvent "FindNext:'" & sToFind & "', flags=" & eFlags
End Sub
Private Sub m_cFR_Replace(ByVal sToReplace As String, ByVal sReplaceWith As
String, ByVal eFlags As EFindReplaceFlags)
LogEvent "Replace:'" & sToReplace & "' with:'" & sReplaceWith & "', flags="
& eFlags
End Sub
Private Sub m_cFR_ReplaceAll(ByVal sToReplace As String, ByVal sReplaceWith As
String, ByVal eFlags As EFindReplaceFlags)
LogEvent "ReplaceAll:'" & sToReplace & "' with:'" & sReplaceWith & "',
flags=" & eFlags
End Sub
Private Sub m_cFR_ShowHelp()
LogEvent "ShowHelp"
End Sub
|
|