home *** CD-ROM | disk | FTP | other *** search
/ ActiveX Programming Unleashed CD / AXU.iso / componen / vsocx / demo / awk.frm (.txt) next >
Encoding:
Visual Basic Form  |  1995-02-02  |  17.2 KB  |  446 lines

  1. VERSION 2.00
  2. Begin Form frmAWK 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "AWK String Parser"
  5.    ClientHeight    =   6300
  6.    ClientLeft      =   615
  7.    ClientTop       =   630
  8.    ClientWidth     =   8730
  9.    Height          =   6765
  10.    Left            =   525
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   6300
  13.    ScaleWidth      =   8730
  14.    Top             =   255
  15.    Width           =   8910
  16.    Begin VideoSoftElastic VSElastic 
  17.       Align           =   5  'Fill Container
  18.       AutoSizeChildren=   2  'Uneven Horizontal
  19.       BevelInner      =   0  'None
  20.       BevelOuter      =   0  'None
  21.       Height          =   2730
  22.       Index           =   10
  23.       IntBkg          =   &H00C0C0C0&
  24.       Left            =   0
  25.       TabIndex        =   2
  26.       Top             =   3570
  27.       Width           =   8730
  28.       Begin VideoSoftElastic VSElastic 
  29.          AutoSizeChildren=   4  'Uneven Vertical
  30.          BevelInner      =   7  'Shadow
  31.          BevelInnerWidth =   3
  32.          BevelOuter      =   0  'None
  33.          FontBold        =   0   'False
  34.          FontItalic      =   0   'False
  35.          FontName        =   "MS Sans Serif"
  36.          FontSize        =   8.25
  37.          FontStrikethru  =   0   'False
  38.          FontUnderline   =   0   'False
  39.          Height          =   2550
  40.          Index           =   9
  41.          IntBkg          =   &H00C0C0C0&
  42.          Left            =   90
  43.          TabIndex        =   3
  44.          TagPosition     =   1  'Above
  45.          TagWidth        =   280
  46.          Top             =   90
  47.          Width           =   5835
  48.          Begin ListBox lstAwk 
  49.             FontBold        =   0   'False
  50.             FontItalic      =   0   'False
  51.             FontName        =   "MS Sans Serif"
  52.             FontSize        =   8.25
  53.             FontStrikethru  =   0   'False
  54.             FontUnderline   =   0   'False
  55.             Height          =   1980
  56.             Left            =   90
  57.             TabIndex        =   4
  58.             Tag             =   "Awk automatically parses your strings according to the field separator"
  59.             Top             =   375
  60.             Width           =   5655
  61.          End
  62.       End
  63.       Begin VideoSoftElastic VSElastic 
  64.          AutoSizeChildren=   3  'Even Vertical
  65.          BevelInner      =   0  'None
  66.          BevelOuter      =   0  'None
  67.          Height          =   2550
  68.          Index           =   7
  69.          IntBkg          =   &H00C0C0C0&
  70.          Left            =   7050
  71.          MaxChildSize    =   600
  72.          TabIndex        =   7
  73.          Top             =   90
  74.          Width           =   1590
  75.          Begin VideoSoftElastic elaButton 
  76.             AccessKey       =   -1  'True
  77.             BevelInner      =   0  'None
  78.             BevelOuter      =   8  'Raised New Look
  79.             BorderWidth     =   8
  80.             Caption         =   "&About"
  81.             CaptionPos      =   7  'Right Center
  82.             CornerColor     =   &H00C0C0C0&
  83.             FontBold        =   0   'False
  84.             FontItalic      =   0   'False
  85.             FontName        =   "MS Sans Serif"
  86.             FontSize        =   8.25
  87.             FontStrikethru  =   0   'False
  88.             FontUnderline   =   0   'False
  89.             Height          =   600
  90.             Index           =   1
  91.             IntBkg          =   &H00C0C0C0&
  92.             Left            =   90
  93.             Picture         =   AWK.FRX:002C
  94.             PicturePos      =   1  'Left Center
  95.             Style           =   3  'Command Button
  96.             TabIndex        =   8
  97.             Top             =   90
  98.             Width           =   1410
  99.          End
  100.       End
  101.       Begin VideoSoftElastic VSElastic 
  102.          BevelOuter      =   0  'None
  103.          ChildSpacing    =   0
  104.          FontBold        =   0   'False
  105.          FontItalic      =   0   'False
  106.          FontName        =   "MS Sans Serif"
  107.          FontSize        =   8.25
  108.          FontStrikethru  =   0   'False
  109.          FontUnderline   =   0   'False
  110.          Height          =   2550
  111.          Index           =   8
  112.          IntBkg          =   &H00C0C0C0&
  113.          Left            =   6015
  114.          TabIndex        =   5
  115.          TagPosition     =   1  'Above
  116.          TagWidth        =   600
  117.          Top             =   90
  118.          Width           =   945
  119.          Begin Label lblNF 
  120.             Alignment       =   2  'Center
  121.             BackColor       =   &H00C0C0C0&
  122.             FontBold        =   0   'False
  123.             FontItalic      =   0   'False
  124.             FontName        =   "MS Sans Serif"
  125.             FontSize        =   8.25
  126.             FontStrikethru  =   0   'False
  127.             FontUnderline   =   0   'False
  128.             ForeColor       =   &H00FF0000&
  129.             Height          =   210
  130.             Left            =   45
  131.             TabIndex        =   6
  132.             Tag             =   "Number of Fields (NF)"
  133.             Top             =   615
  134.             Width           =   810
  135.          End
  136.       End
  137.    End
  138.    Begin VideoSoftElastic VSElastic 
  139.       Align           =   1  'Top
  140.       AutoSizeChildren=   4  'Uneven Vertical
  141.       BevelInner      =   8  'Raised New Look
  142.       BevelInnerWidth =   3
  143.       BevelOuter      =   0  'None
  144.       BorderWidth     =   16
  145.       ChildSpacing    =   18
  146.       Height          =   3570
  147.       Index           =   1
  148.       IntBkg          =   &H00C0C0C0&
  149.       Left            =   0
  150.       TabIndex        =   1
  151.       Top             =   0
  152.       Width           =   8730
  153.       Begin VideoSoftElastic VSElastic 
  154.          BevelInner      =   0  'None
  155.          BevelOuter      =   0  'None
  156.          BorderWidth     =   0
  157.          Caption         =   "vs/AWK String Parser"
  158.          CaptionPos      =   4  'Center Center
  159.          CaptionStyle    =   1  'Raised
  160.          FontBold        =   -1  'True
  161.          FontItalic      =   0   'False
  162.          FontName        =   "Times New Roman"
  163.          FontSize        =   24
  164.          FontStrikethru  =   0   'False
  165.          FontUnderline   =   0   'False
  166.          ForeColor       =   &H00FF0000&
  167.          Height          =   615
  168.          Index           =   0
  169.          IntBkg          =   &H00C0C0C0&
  170.          Left            =   240
  171.          PicturePos      =   9  'Stretch
  172.          TabIndex        =   0
  173.          Top             =   240
  174.          Width           =   8250
  175.       End
  176.       Begin VideoSoftElastic VSElastic 
  177.          AutoSizeChildren=   2  'Uneven Horizontal
  178.          BevelInner      =   0  'None
  179.          BevelOuter      =   0  'None
  180.          BorderWidth     =   3
  181.          Height          =   2205
  182.          Index           =   2
  183.          IntBkg          =   &H00C0C0C0&
  184.          Left            =   240
  185.          TabIndex        =   9
  186.          Top             =   1125
  187.          Width           =   8250
  188.          Begin VideoSoftElastic VSElastic 
  189.             AutoSizeChildren=   3  'Even Vertical
  190.             BevelChildren   =   2  'No Elastics
  191.             BevelInner      =   9  'Inset New Look
  192.             BevelOuter      =   0  'None
  193.             BorderWidth     =   8
  194.             CaptionPos      =   2  'Left Bottom
  195.             FontBold        =   0   'False
  196.             FontItalic      =   0   'False
  197.             FontName        =   "MS Sans Serif"
  198.             FontSize        =   8.25
  199.             FontStrikethru  =   0   'False
  200.             FontUnderline   =   0   'False
  201.             Height          =   2115
  202.             Index           =   3
  203.             IntBkg          =   &H00C0C0C0&
  204.             Left            =   45
  205.             MaxChildSize    =   550
  206.             TabIndex        =   18
  207.             TagPosition     =   1  'Above
  208.             TagWidth        =   280
  209.             Top             =   45
  210.             Width           =   6315
  211.             Begin TextBox txtF0 
  212.                BorderStyle     =   0  'None
  213.                FontBold        =   0   'False
  214.                FontItalic      =   0   'False
  215.                FontName        =   "MS Sans Serif"
  216.                FontSize        =   8.25
  217.                FontStrikethru  =   0   'False
  218.                FontUnderline   =   0   'False
  219.                Height          =   270
  220.                Left            =   120
  221.                TabIndex        =   20
  222.                Tag             =   "Enter your text here"
  223.                Text            =   "hello world"
  224.                Top             =   405
  225.                Width           =   6075
  226.             End
  227.             Begin TextBox txtFS 
  228.                BorderStyle     =   0  'None
  229.                FontBold        =   0   'False
  230.                FontItalic      =   0   'False
  231.                FontName        =   "MS Sans Serif"
  232.                FontSize        =   8.25
  233.                FontStrikethru  =   0   'False
  234.                FontUnderline   =   0   'False
  235.                Height          =   270
  236.                Left            =   120
  237.                TabIndex        =   19
  238.                Tag             =   "Field Separator (FS)"
  239.                Top             =   1050
  240.                Width           =   6075
  241.             End
  242.          End
  243.          Begin VideoSoftElastic VSElastic 
  244.             AutoSizeChildren=   3  'Even Vertical
  245.             BevelInner      =   0  'None
  246.             BevelOuter      =   0  'None
  247.             Height          =   2115
  248.             Index           =   4
  249.             IntBkg          =   &H00C0C0C0&
  250.             Left            =   6450
  251.             MaxChildSize    =   1750
  252.             TabIndex        =   10
  253.             Top             =   45
  254.             Width           =   1755
  255.             Begin VideoSoftElastic elaButton 
  256.                AccessKey       =   -1  'True
  257.                BevelInnerWidth =   0
  258.                BevelOuter      =   8  'Raised New Look
  259.                Caption         =   "&Parse String"
  260.                CaptionPos      =   7  'Right Center
  261.                FontBold        =   0   'False
  262.                FontItalic      =   0   'False
  263.                FontName        =   "MS Sans Serif"
  264.                FontSize        =   8.25
  265.                FontStrikethru  =   0   'False
  266.                FontUnderline   =   0   'False
  267.                Height          =   585
  268.                Index           =   2
  269.                IntBkg          =   &H00C0C0C0&
  270.                Left            =   90
  271.                Picture         =   AWK.FRX:037B
  272.                PicturePos      =   1  'Left Center
  273.                Style           =   3  'Command Button
  274.                TabIndex        =   17
  275.                Top             =   1440
  276.                Width           =   1575
  277.             End
  278.             Begin VideoSoftElastic VSElastic 
  279.                AutoSizeChildren=   1  'Even Horizontal
  280.                BevelInner      =   0  'None
  281.                BevelOuter      =   8  'Raised New Look
  282.                BorderWidth     =   5
  283.                Caption         =   " Match Quotes "
  284.                FontBold        =   0   'False
  285.                FontItalic      =   0   'False
  286.                FontName        =   "MS Sans Serif"
  287.                FontSize        =   8.25
  288.                FontStrikethru  =   0   'False
  289.                FontUnderline   =   0   'False
  290.                Height          =   585
  291.                Index           =   6
  292.                IntBkg          =   &H00C0C0C0&
  293.                Left            =   90
  294.                Style           =   1  'Frame Top
  295.                TabIndex        =   14
  296.                Top             =   765
  297.                Width           =   1575
  298.                Begin OptionButton optMatchQuotes 
  299.                   BackColor       =   &H00C0C0C0&
  300.                   Caption         =   "False"
  301.                   FontBold        =   0   'False
  302.                   FontItalic      =   0   'False
  303.                   FontName        =   "MS Sans Serif"
  304.                   FontSize        =   8.25
  305.                   FontStrikethru  =   0   'False
  306.                   FontUnderline   =   0   'False
  307.                   Height          =   195
  308.                   Index           =   1
  309.                   Left            =   75
  310.                   TabIndex        =   16
  311.                   Top             =   315
  312.                   Width           =   675
  313.                End
  314.                Begin OptionButton optMatchQuotes 
  315.                   BackColor       =   &H00C0C0C0&
  316.                   Caption         =   "True"
  317.                   FontBold        =   0   'False
  318.                   FontItalic      =   0   'False
  319.                   FontName        =   "MS Sans Serif"
  320.                   FontSize        =   8.25
  321.                   FontStrikethru  =   0   'False
  322.                   FontUnderline   =   0   'False
  323.                   Height          =   195
  324.                   Index           =   0
  325.                   Left            =   840
  326.                   TabIndex        =   15
  327.                   Top             =   315
  328.                   Width           =   660
  329.                End
  330.             End
  331.             Begin VideoSoftElastic VSElastic 
  332.                AutoSizeChildren=   1  'Even Horizontal
  333.                BevelInner      =   0  'None
  334.                BevelOuter      =   8  'Raised New Look
  335.                BorderWidth     =   5
  336.                Caption         =   " Filter Quotes "
  337.                FontBold        =   0   'False
  338.                FontItalic      =   0   'False
  339.                FontName        =   "MS Sans Serif"
  340.                FontSize        =   8.25
  341.                FontStrikethru  =   0   'False
  342.                FontUnderline   =   0   'False
  343.                Height          =   585
  344.                Index           =   5
  345.                IntBkg          =   &H00C0C0C0&
  346.                Left            =   90
  347.                Style           =   1  'Frame Top
  348.                TabIndex        =   11
  349.                Top             =   90
  350.                Width           =   1575
  351.                Begin OptionButton optFilterQuotes 
  352.                   BackColor       =   &H00C0C0C0&
  353.                   Caption         =   "True"
  354.                   FontBold        =   0   'False
  355.                   FontItalic      =   0   'False
  356.                   FontName        =   "MS Sans Serif"
  357.                   FontSize        =   8.25
  358.                   FontStrikethru  =   0   'False
  359.                   FontUnderline   =   0   'False
  360.                   Height          =   195
  361.                   Index           =   1
  362.                   Left            =   840
  363.                   TabIndex        =   13
  364.                   Top             =   315
  365.                   Width           =   660
  366.                End
  367.                Begin OptionButton optFilterQuotes 
  368.                   BackColor       =   &H00C0C0C0&
  369.                   Caption         =   "False"
  370.                   FontBold        =   0   'False
  371.                   FontItalic      =   0   'False
  372.                   FontName        =   "MS Sans Serif"
  373.                   FontSize        =   8.25
  374.                   FontStrikethru  =   0   'False
  375.                   FontUnderline   =   0   'False
  376.                   Height          =   195
  377.                   Index           =   0
  378.                   Left            =   75
  379.                   TabIndex        =   12
  380.                   Top             =   315
  381.                   Width           =   675
  382.                End
  383.             End
  384.          End
  385.       End
  386.    End
  387.    Begin VideoSoftAwk VSAwk1 
  388.       FS              =   " ,    "
  389.       Left            =   7935
  390.       Top             =   300
  391.    End
  392. Option Explicit
  393. Declare Function vbrig_nlSetHorizScrollBar Lib "User" Alias "SendMessage" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
  394. Const WM_USER = 1024
  395. Const LB_SETTABSTOPS = WM_USER + 19
  396. Const LB_SETHORIZONTALEXTENT = WM_USER + 21
  397. Const EM_SETTABSTOPS = WM_USER + 27
  398. Sub DoAwk ()
  399.   Dim i As Integer
  400.   Dim rc As Integer
  401.   'Set AWK properties for parsing
  402.   VSAwk1.FS = txtFS.Text
  403.   VSAwk1.MatchQuotes = IIf(optMatchQuotes(0).Value, True, False)
  404.   VSAwk1.FilterQuotes = IIf(optMatchQuotes(0).Value, True, False)
  405.   'process awk
  406.   VSAwk1.F(0) = txtF0.Text
  407.   'display results
  408.   lblNF.Caption = VSAwk1.NF
  409.   lstAwk.Clear
  410.   For i = 0 To VSAwk1.NF
  411.     lstAwk.AddItem "Field(" & i & ")" & Chr$(9) & VSAwk1.F(i)
  412.   Next i
  413.   rc = vbrig_nlSetHorizScrollBar(lstAwk.hWnd, LB_SETHORIZONTALEXTENT, (lstAwk.Width * 2) \ Screen.TwipsPerPixelX, 0)
  414. End Sub
  415. Sub elaButton_Click (Index As Integer)
  416.   Dim Msg$, NL$
  417.   NL = Chr$(13)
  418.   Select Case Index
  419.     Case 1  'About
  420.       Msg = "Part of the VideoSoft String Parser demo was written by: " & NL & NL
  421.       Msg = Msg & "John Chmela " & NL
  422.       Msg = Msg & "President" & NL
  423.       Msg = Msg & "Universal Software Consulting Services " & NL
  424.       Msg = Msg & "10300 S. Cicero Ave. " & NL
  425.       Msg = Msg & "Oak Lawn, IL 60453 " & NL
  426.       Msg = Msg & "708/430-2819 " & NL
  427.       Msg = Msg & "708/430-3643 Fax " & NL
  428.       Msg = Msg & "72066,3035 CIS " & NL
  429.       Msg = Msg & "chmela@mcs.com " & NL & NL
  430.       MsgBox Msg, 64, "Awk!"
  431.   Case 2  'Parse string
  432.       DoAwk
  433.   End Select
  434. End Sub
  435. Sub Form_Load ()
  436.   optMatchQuotes(0).Value = True
  437.   optFilterQuotes(0).Value = True
  438.   txtFS.Text = VSAwk1.FS
  439. End Sub
  440. Sub txtF0_KeyPress (KeyAscii As Integer)
  441.   If KeyAscii = 13 Then
  442.     KeyAscii = 0
  443.     DoAwk
  444.   End If
  445. End Sub
  446.