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

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