home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / componen / vsflex / demo / fwalk.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-30  |  6.4 KB  |  214 lines

  1. VERSION 2.00
  2. Begin Form fWalk 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Walk through Strings"
  6.    ClientHeight    =   3630
  7.    ClientLeft      =   855
  8.    ClientTop       =   975
  9.    ClientWidth     =   5805
  10.    Height          =   4035
  11.    Left            =   795
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3630
  14.    ScaleWidth      =   5805
  15.    Top             =   630
  16.    Width           =   5925
  17.    Begin vsFlexString fs 
  18.       Left            =   330
  19.       Pattern         =   "[^ ,\t.]*"
  20.       Text            =   "VideoSoft FlexString"
  21.       Top             =   2820
  22.    End
  23.    Begin CommandButton Command1 
  24.       BackColor       =   &H00000000&
  25.       Caption         =   "&Go To Word #..."
  26.       Default         =   -1  'True
  27.       FontBold        =   0   'False
  28.       FontItalic      =   0   'False
  29.       FontName        =   "MS Sans Serif"
  30.       FontSize        =   8.25
  31.       FontStrikethru  =   0   'False
  32.       FontUnderline   =   0   'False
  33.       Height          =   375
  34.       Left            =   2685
  35.       TabIndex        =   0
  36.       Top             =   2595
  37.       Width           =   1470
  38.    End
  39.    Begin CommandButton Command3 
  40.       BackColor       =   &H00000000&
  41.       Caption         =   "Next Word"
  42.       FontBold        =   0   'False
  43.       FontItalic      =   0   'False
  44.       FontName        =   "MS Sans Serif"
  45.       FontSize        =   8.25
  46.       FontStrikethru  =   0   'False
  47.       FontUnderline   =   0   'False
  48.       Height          =   405
  49.       Index           =   1
  50.       Left            =   1170
  51.       TabIndex        =   6
  52.       Top             =   2595
  53.       Width           =   1380
  54.    End
  55.    Begin CommandButton Command3 
  56.       BackColor       =   &H00000000&
  57.       Caption         =   "Previous Word"
  58.       FontBold        =   0   'False
  59.       FontItalic      =   0   'False
  60.       FontName        =   "MS Sans Serif"
  61.       FontSize        =   8.25
  62.       FontStrikethru  =   0   'False
  63.       FontUnderline   =   0   'False
  64.       Height          =   405
  65.       Index           =   0
  66.       Left            =   1170
  67.       TabIndex        =   5
  68.       Top             =   2970
  69.       Width           =   1380
  70.    End
  71.    Begin TextBox Text3 
  72.       FontBold        =   0   'False
  73.       FontItalic      =   0   'False
  74.       FontName        =   "MS Sans Serif"
  75.       FontSize        =   8.25
  76.       FontStrikethru  =   0   'False
  77.       FontUnderline   =   0   'False
  78.       Height          =   285
  79.       Left            =   3750
  80.       TabIndex        =   4
  81.       Tag             =   "&Match#"
  82.       Text            =   "0"
  83.       Top             =   930
  84.       Width           =   690
  85.    End
  86.    Begin TextBox Text2 
  87.       BackColor       =   &H00C0C0C0&
  88.       Enabled         =   0   'False
  89.       Height          =   300
  90.       Left            =   3735
  91.       TabIndex        =   3
  92.       Tag             =   "&Pattern"
  93.       Text            =   "[^ .,\t]*"
  94.       Top             =   480
  95.       Width           =   1740
  96.    End
  97.    Begin TextBox Text1 
  98.       FontBold        =   0   'False
  99.       FontItalic      =   0   'False
  100.       FontName        =   "Arial"
  101.       FontSize        =   13.5
  102.       FontStrikethru  =   0   'False
  103.       FontUnderline   =   0   'False
  104.       Height          =   2430
  105.       HideSelection   =   0   'False
  106.       Left            =   225
  107.       MultiLine       =   -1  'True
  108.       TabIndex        =   2
  109.       Tag             =   "&Text"
  110.       Text            =   "This is a long string that will be used as a target for the FlexString control."
  111.       Top             =   105
  112.       Width           =   2340
  113.    End
  114.    Begin TextBox Text4 
  115.       FontBold        =   0   'False
  116.       FontItalic      =   0   'False
  117.       FontName        =   "MS Sans Serif"
  118.       FontSize        =   8.25
  119.       FontStrikethru  =   0   'False
  120.       FontUnderline   =   0   'False
  121.       Height          =   285
  122.       Left            =   3750
  123.       TabIndex        =   1
  124.       Tag             =   "&Match"
  125.       Top             =   1425
  126.       Width           =   1245
  127.    End
  128.    Begin Label Label1 
  129.       AutoSize        =   -1  'True
  130.       BackStyle       =   0  'Transparent
  131.       Caption         =   "Word text:"
  132.       FontBold        =   0   'False
  133.       FontItalic      =   0   'False
  134.       FontName        =   "MS Sans Serif"
  135.       FontSize        =   8.25
  136.       FontStrikethru  =   0   'False
  137.       FontUnderline   =   0   'False
  138.       Height          =   195
  139.       Index           =   1
  140.       Left            =   2910
  141.       TabIndex        =   8
  142.       Top             =   1455
  143.       Width           =   735
  144.    End
  145.    Begin Label Label1 
  146.       AutoSize        =   -1  'True
  147.       BackStyle       =   0  'Transparent
  148.       Caption         =   "Word #"
  149.       FontBold        =   0   'False
  150.       FontItalic      =   0   'False
  151.       FontName        =   "MS Sans Serif"
  152.       FontSize        =   8.25
  153.       FontStrikethru  =   0   'False
  154.       FontUnderline   =   0   'False
  155.       Height          =   195
  156.       Index           =   0
  157.       Left            =   3015
  158.       TabIndex        =   7
  159.       Top             =   945
  160.       Width           =   540
  161.    End
  162. Option Explicit
  163. Sub Command1_Click ()
  164.   Dim Answer
  165.     Answer = Val(InputBox("To which word number would you like to go", "VideoSoft", text3)) ' Get user input.
  166.   Loop Until Answer >= 0 And Answer <= fs.MatchCount - 1
  167.   text3 = Str$(Answer)
  168.   DoWalk
  169. End Sub
  170. Sub Command3_Click (Index%)
  171.   Select Case Index
  172.     Case 0  ' Previous word
  173.       If Val(text3) = 0 Then
  174.     text3 = 0
  175.     Beep
  176.       Else
  177.     text3 = Format(Val(text3) - 1)
  178.       End If
  179.       
  180.     Case 1  ' Next word
  181.       If Val(text3) = fs.MatchCount - 1 Then
  182.     text3 = fs.MatchCount - 1
  183.     Beep
  184.       Else
  185.     text3 = Format(Val(text3) + 1)
  186.       End If
  187.   End Select
  188.   DoWalk
  189. End Sub
  190. Sub DoWalk ()
  191.     ' set matcher parameters
  192.     fs = text1
  193.     fs.Pattern = text2
  194.     fs.MatchIndex = Val(text3)
  195.     ' show number of matches
  196.     'label1 = fs.MatchCount + " Matches found"
  197.     ' show match
  198.     If fs.MatchStart >= 0 Then
  199.     text1.SelStart = fs.MatchStart
  200.     text1.SelLength = fs.MatchLength
  201.     text4 = fs.MatchString
  202.     Else
  203.     text1.SelStart = 0
  204.     text1.SelLength = 0
  205.     text4 = "NOT FOUND"
  206.     End If
  207. End Sub
  208. Sub Form_Load ()
  209.     fs = text1
  210.     fs.Pattern = text2
  211.     fs.MatchIndex = Val(text3)
  212.     DoWalk
  213. End Sub
  214.