home *** CD-ROM | disk | FTP | other *** search
/ The Best of Select: Windows 95 Special 2 / WIN95_2.bin / utils / envelop / envelop.6 / Tools / Bootcamp / basic / apifind / apifind.eto < prev    next >
Encoding:
Text File  |  1996-07-08  |  4.7 KB  |  133 lines

  1. Type APIFindMasterForm From SampleMasterForm
  2.   Dim btnFind As New Button
  3.   Dim Label1 As New Label
  4.   Dim Label2 As New Label
  5.   Dim txtSearchString As New TextBox
  6.   Dim txtSearchBox As New TextBox
  7.   Dim FindPanel As New FindDialog
  8.  
  9.   ' METHODS for object: APIFindMasterForm
  10.   Sub btnFind_Click()
  11.     If txtSearchString.Text == "" Then 
  12.       InfoBox.Message("Warning", "No search string specified!")
  13.       txtSearchString.SetFocus
  14.       Exit Sub
  15.     End If
  16.   
  17.     ' Hide some items on the FindDialog panel
  18.     FindPanel.HideMatchCase = "True"
  19.     FindPanel.HideUpDown = "True"
  20.     FindPanel.HideWholeWord = "True"
  21.     FindPanel.FindString = txtSearchString.Text
  22.   
  23.     ' Post the find panel
  24.     FindPanel.Show
  25.   
  26.   End Sub
  27.  
  28.   Sub FindPanel_Find()
  29.     Dim loc As Integer
  30.   
  31.     ' The FindPanel invokes a Find method when the FindNext button is clicked
  32.     loc = Instr(txtSearchBox.SelStart + 1 + txtSearchBox.SelLength, txtSearchBox.Text, FindPanel.FindString)
  33.     If loc Then 
  34.       txtSearchBox.SelStart = loc - 1
  35.       txtSearchBox.SelLength = Len(FindPanel.FindString)
  36.       txtSearchBox.SetFocus
  37.     Else 
  38.       InfoBox.Message("", "Cannot find '" & FindPanel.FindString & "'")
  39.     End If
  40.   End Sub
  41.  
  42.   Sub ResetApplication_Click ()
  43.   
  44.     Dim newline As String
  45.     Dim tmpstring As String
  46.   
  47.     newline = Chr(13) & Chr(10)
  48.   
  49.     ' Initialize Find Dialog Demonstration
  50.     tmpstring = "Sometimes, when you are feeling important," & newline
  51.     tmpstring = tmpstring & "Sometimes, when your ego's in bloom," & newline
  52.     tmpstring = tmpstring & "Sometimes, when you take it for granted" & newline
  53.     tmpstring = tmpstring & "You're the best qualified in the room." & newline
  54.     tmpstring = tmpstring & newline
  55.     tmpstring = tmpstring & "Sometime, when you feel that your going" & newline
  56.     tmpstring = tmpstring & "Would leave an un-fillable hole," & newline
  57.     tmpstring = tmpstring & "Just follow this simple instruction" & newline
  58.     tmpstring = tmpstring & "And see how it humbles your soul." & newline
  59.     tmpstring = tmpstring & newline
  60.     tmpstring = tmpstring & "Take a bucket and fill it with water," & newline
  61.     tmpstring = tmpstring & "Put your hand in it, up to your wrist," & newline
  62.     tmpstring = tmpstring & "Pull it out, and the hole that's remaining" & newline
  63.     tmpstring = tmpstring & "Is a measure of how much you'll be missed." & newline
  64.     tmpstring = tmpstring & newline
  65.     tmpstring = tmpstring & "You may splash all you please when you enter," & newline
  66.     tmpstring = tmpstring & "You can stir up the water galore," & newline
  67.     tmpstring = tmpstring & "But stop and you'll find in a minute" & newline
  68.     tmpstring = tmpstring & "That it looks quite the same as before." & newline
  69.     tmpstring = tmpstring & newline
  70.     tmpstring = tmpstring & "The moral in this quaint example" & newline
  71.     tmpstring = tmpstring & "Is do just the best that you can," & newline
  72.     tmpstring = tmpstring & "Be proud of yourself, but remember," & newline
  73.     tmpstring = tmpstring & "There is no indispensable man." & newline
  74.   
  75.     ' Set the default textbox attributes
  76.     txtSearchBox.MultiLine = "True"
  77.     txtSearchBox.ScrollBars = 2
  78.   
  79.     ' Put the test string in the textbox
  80.     txtSearchBox.Text = tmpstring
  81.   
  82.     ' Set a default search string
  83.     txtSearchString.Text = ""
  84.   
  85.     txtSearchString.SetFocus
  86.   
  87.   End Sub
  88.  
  89. End Type
  90.  
  91. Begin Code
  92. ' Reconstruction commands for object: APIFindMasterForm
  93. '
  94.   With APIFindMasterForm
  95.     .Caption := "Windows Find Dialog Demonstration"
  96.     .Move(4995, 1140, 6885, 5490)
  97.     .CurrentY := 16
  98.     .SampleDir := "W:\Examples\apifind\"
  99.     .SampleName := "apifind"
  100.     With .btnFind
  101.       .Caption := "Find"
  102.       .Move(5400, 600, 1050, 450)
  103.     End With  'APIFindMasterForm.btnFind
  104.     With .Label1
  105.       .Caption := "1. Key in a search string, then click Find button."
  106.       .ForeColor := 13107200
  107.       .Move(300, 300, 4800, 300)
  108.     End With  'APIFindMasterForm.Label1
  109.     With .Label2
  110.       .Caption := "Search For:"
  111.       .Move(450, 750, 1200, 300)
  112.     End With  'APIFindMasterForm.Label2
  113.     With .txtSearchString
  114.       .Move(1800, 750, 3300, 360)
  115.     End With  'APIFindMasterForm.txtSearchString
  116.     With .txtSearchBox
  117.       .Move(450, 1350, 5850, 3150)
  118.       .WordWrap := True
  119.       .ScrollBars := "Vertical"
  120.       .MultiLine := True
  121.     End With  'APIFindMasterForm.txtSearchBox
  122.     With .FindPanel
  123.       .FindString := "best"
  124.       .HideUpDown := True
  125.       .HideMatchCase := True
  126.       .HideWholeWord := True
  127.     End With  'APIFindMasterForm.FindPanel
  128.     With .helpfile
  129.       .FileName := "W:\Examples\apifind\apifind.hlp"
  130.     End With  'APIFindMasterForm.helpfile
  131.   End With  'APIFindMasterForm
  132. End Code
  133.