home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 13 / CD_ASCQ_13_0494.iso / maj / 1697 / samples / replace.frm < prev    next >
Text File  |  1993-10-13  |  6KB  |  202 lines

  1. VERSION 2.00
  2. Begin Form frmReplace 
  3.    Caption         =   "Replace"
  4.    Height          =   3390
  5.    Left            =   720
  6.    LinkTopic       =   "Form2"
  7.    ScaleHeight     =   2985
  8.    ScaleWidth      =   4905
  9.    Top             =   1695
  10.    Width           =   5025
  11.    Begin ComboBox comboNewText 
  12.       Height          =   300
  13.       Left            =   1080
  14.       TabIndex        =   2
  15.       Top             =   600
  16.       Width           =   2535
  17.    End
  18.    Begin ComboBox comboText 
  19.       Height          =   300
  20.       Left            =   1080
  21.       TabIndex        =   0
  22.       Top             =   210
  23.       Width           =   2535
  24.    End
  25.    Begin Frame Frame4 
  26.       Caption         =   "Origin"
  27.       Height          =   975
  28.       Left            =   2610
  29.       TabIndex        =   11
  30.       Top             =   1530
  31.       Width           =   2055
  32.       Begin OptionButton optOrigin 
  33.          Caption         =   "&From cursor"
  34.          Height          =   285
  35.          Index           =   1
  36.          Left            =   240
  37.          TabIndex        =   13
  38.          Top             =   240
  39.          Value           =   -1  'True
  40.          Width           =   1575
  41.       End
  42.       Begin OptionButton optOrigin 
  43.          Caption         =   "&Entire Scope"
  44.          Height          =   285
  45.          Index           =   0
  46.          Left            =   240
  47.          TabIndex        =   12
  48.          Top             =   600
  49.          Width           =   1575
  50.       End
  51.    End
  52.    Begin Frame Frame1 
  53.       Caption         =   "Direction"
  54.       Height          =   570
  55.       Left            =   120
  56.       TabIndex        =   7
  57.       Top             =   2310
  58.       Width           =   2175
  59.       Begin OptionButton optDirection 
  60.          Caption         =   "&Down"
  61.          Height          =   252
  62.          Index           =   1
  63.          Left            =   960
  64.          TabIndex        =   9
  65.          Top             =   240
  66.          Value           =   -1  'True
  67.          Width           =   852
  68.       End
  69.       Begin OptionButton optDirection 
  70.          Caption         =   "&Up"
  71.          Height          =   252
  72.          Index           =   0
  73.          Left            =   240
  74.          TabIndex        =   8
  75.          Top             =   240
  76.          Width           =   612
  77.       End
  78.    End
  79.    Begin CheckBox chkCase 
  80.       Caption         =   "Match &Case"
  81.       Height          =   375
  82.       Left            =   240
  83.       TabIndex        =   5
  84.       Top             =   1320
  85.       Width           =   1455
  86.    End
  87.    Begin CommandButton cmdcancel 
  88.       Cancel          =   -1  'True
  89.       Caption         =   "Cancel"
  90.       Height          =   372
  91.       Left            =   3720
  92.       TabIndex        =   4
  93.       Top             =   600
  94.       Width           =   1092
  95.    End
  96.    Begin CommandButton cmdOK 
  97.       Caption         =   "&OK"
  98.       Default         =   -1  'True
  99.       Height          =   372
  100.       Left            =   3720
  101.       TabIndex        =   3
  102.       Top             =   120
  103.       Width           =   1092
  104.    End
  105.    Begin Frame Frame2 
  106.       Caption         =   "Options"
  107.       Height          =   975
  108.       Left            =   120
  109.       TabIndex        =   10
  110.       Top             =   1080
  111.       Width           =   2175
  112.       Begin CheckBox chkWholeWords 
  113.          Caption         =   "&Whole Words Only"
  114.          Height          =   315
  115.          Left            =   120
  116.          TabIndex        =   6
  117.          Top             =   600
  118.          Width           =   1935
  119.       End
  120.    End
  121.    Begin Label Label2 
  122.       Caption         =   "&New Text:"
  123.       Height          =   255
  124.       Left            =   120
  125.       TabIndex        =   14
  126.       Top             =   600
  127.       Width           =   975
  128.    End
  129.    Begin Label Label1 
  130.       Caption         =   "Fi&nd What:"
  131.       Height          =   255
  132.       Index           =   0
  133.       Left            =   120
  134.       TabIndex        =   1
  135.       Top             =   240
  136.       Width           =   975
  137.    End
  138. End
  139. Option Explicit
  140.  
  141. Sub cmdCancel_Click ()
  142. '    gFindString = comboText.Text
  143.     Hide
  144. End Sub
  145.  
  146. Sub cmdOK_Click ()
  147.     ' It seems that VB does not let you pass control properties directly, so you are
  148.     ' preventing from writing...
  149.     '    FindIt comboText.Text, MatchCase, WholeWordOnly, optScope(0).Value, optDirection(0).Value, optOrigin(0).Value
  150.     ' ...instead you have to assign the properites to variables and then pass the variables.
  151.     ' Kinda lame.
  152.     gTargetText = comboText.Text
  153.     gNewText = comboNewText.Text
  154.     gBeginScope = optOrigin(0).Value
  155.     gUpDirection = optDirection(0).Value
  156.  
  157.     If chkCase.Value = 1 Then
  158.         gMatchCase = True
  159.     Else
  160.         gMatchCase = False
  161.     End If
  162.     If chkWholeWords.Value = 1 Then
  163.         gWholeWordOnly = True
  164.     Else
  165.         gWholeWordOnly = False
  166.     End If
  167.     
  168. '    gFindString = comboText.Text
  169.     UpdateComboList comboText, gTargetText  ' add text to combo list if not already exists
  170.     UpdateComboList comboNewText, gNewText
  171.     Hide
  172.  
  173.     Dim IsRepeat As Integer
  174.     Do
  175.         Dim FoundIt As Integer
  176.         ' repeat the last find
  177.         FoundIt = FindIt(gTargetText, gMatchCase, gWholeWordOnly, gUpDirection, gBeginScope, gNewText, True, IsRepeat)
  178.         If FoundIt <= 0 Then Exit Do
  179.         IsRepeat = True
  180.     Loop
  181. End Sub
  182.  
  183. Sub comboText_Change ()
  184.     gFirstTime = True
  185.  
  186.     If comboText.Text = "" Then
  187.         cmdOK.Enabled = False
  188.     Else
  189.         cmdOK.Enabled = True
  190.     End If
  191. End Sub
  192.  
  193. Sub Form_Load ()
  194.     cmdOK.Enabled = False
  195.     'gFindDirection = 1
  196. End Sub
  197.  
  198. Sub optDirection_Click (Index As Integer)
  199.     'gFindDirection = Index
  200. End Sub
  201.  
  202.