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