home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 13
/
CD_ASCQ_13_0494.iso
/
maj
/
1697
/
samples
/
replace.frm
< prev
next >
Wrap
Text File
|
1993-10-13
|
6KB
|
202 lines
VERSION 2.00
Begin Form frmReplace
Caption = "Replace"
Height = 3390
Left = 720
LinkTopic = "Form2"
ScaleHeight = 2985
ScaleWidth = 4905
Top = 1695
Width = 5025
Begin ComboBox comboNewText
Height = 300
Left = 1080
TabIndex = 2
Top = 600
Width = 2535
End
Begin ComboBox comboText
Height = 300
Left = 1080
TabIndex = 0
Top = 210
Width = 2535
End
Begin Frame Frame4
Caption = "Origin"
Height = 975
Left = 2610
TabIndex = 11
Top = 1530
Width = 2055
Begin OptionButton optOrigin
Caption = "&From cursor"
Height = 285
Index = 1
Left = 240
TabIndex = 13
Top = 240
Value = -1 'True
Width = 1575
End
Begin OptionButton optOrigin
Caption = "&Entire Scope"
Height = 285
Index = 0
Left = 240
TabIndex = 12
Top = 600
Width = 1575
End
End
Begin Frame Frame1
Caption = "Direction"
Height = 570
Left = 120
TabIndex = 7
Top = 2310
Width = 2175
Begin OptionButton optDirection
Caption = "&Down"
Height = 252
Index = 1
Left = 960
TabIndex = 9
Top = 240
Value = -1 'True
Width = 852
End
Begin OptionButton optDirection
Caption = "&Up"
Height = 252
Index = 0
Left = 240
TabIndex = 8
Top = 240
Width = 612
End
End
Begin CheckBox chkCase
Caption = "Match &Case"
Height = 375
Left = 240
TabIndex = 5
Top = 1320
Width = 1455
End
Begin CommandButton cmdcancel
Cancel = -1 'True
Caption = "Cancel"
Height = 372
Left = 3720
TabIndex = 4
Top = 600
Width = 1092
End
Begin CommandButton cmdOK
Caption = "&OK"
Default = -1 'True
Height = 372
Left = 3720
TabIndex = 3
Top = 120
Width = 1092
End
Begin Frame Frame2
Caption = "Options"
Height = 975
Left = 120
TabIndex = 10
Top = 1080
Width = 2175
Begin CheckBox chkWholeWords
Caption = "&Whole Words Only"
Height = 315
Left = 120
TabIndex = 6
Top = 600
Width = 1935
End
End
Begin Label Label2
Caption = "&New Text:"
Height = 255
Left = 120
TabIndex = 14
Top = 600
Width = 975
End
Begin Label Label1
Caption = "Fi&nd What:"
Height = 255
Index = 0
Left = 120
TabIndex = 1
Top = 240
Width = 975
End
End
Option Explicit
Sub cmdCancel_Click ()
' gFindString = comboText.Text
Hide
End Sub
Sub cmdOK_Click ()
' It seems that VB does not let you pass control properties directly, so you are
' preventing from writing...
' FindIt comboText.Text, MatchCase, WholeWordOnly, optScope(0).Value, optDirection(0).Value, optOrigin(0).Value
' ...instead you have to assign the properites to variables and then pass the variables.
' Kinda lame.
gTargetText = comboText.Text
gNewText = comboNewText.Text
gBeginScope = optOrigin(0).Value
gUpDirection = optDirection(0).Value
If chkCase.Value = 1 Then
gMatchCase = True
Else
gMatchCase = False
End If
If chkWholeWords.Value = 1 Then
gWholeWordOnly = True
Else
gWholeWordOnly = False
End If
' gFindString = comboText.Text
UpdateComboList comboText, gTargetText ' add text to combo list if not already exists
UpdateComboList comboNewText, gNewText
Hide
Dim IsRepeat As Integer
Do
Dim FoundIt As Integer
' repeat the last find
FoundIt = FindIt(gTargetText, gMatchCase, gWholeWordOnly, gUpDirection, gBeginScope, gNewText, True, IsRepeat)
If FoundIt <= 0 Then Exit Do
IsRepeat = True
Loop
End Sub
Sub comboText_Change ()
gFirstTime = True
If comboText.Text = "" Then
cmdOK.Enabled = False
Else
cmdOK.Enabled = True
End If
End Sub
Sub Form_Load ()
cmdOK.Enabled = False
'gFindDirection = 1
End Sub
Sub optDirection_Click (Index As Integer)
'gFindDirection = Index
End Sub