home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1998 October / DPPCPRO1098.ISO / Ocx / VCFIMP / VCIMPRES.Z / dataform.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-11-01  |  8.8 KB  |  289 lines

  1. VERSION 4.00
  2. Begin VB.Form frmData 
  3.    Caption         =   "First Impression Formatting Example 2"
  4.    ClientHeight    =   5715
  5.    ClientLeft      =   2100
  6.    ClientTop       =   5205
  7.    ClientWidth     =   8610
  8.    Height          =   6465
  9.    Left            =   2010
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5715
  12.    ScaleWidth      =   8610
  13.    Top             =   4545
  14.    Width           =   8790
  15.    Begin VB.TextBox Text2 
  16.       BeginProperty Font 
  17.          name            =   "MS Sans Serif"
  18.          charset         =   0
  19.          weight          =   700
  20.          size            =   8.25
  21.          underline       =   0   'False
  22.          italic          =   0   'False
  23.          strikethrough   =   0   'False
  24.       EndProperty
  25.       Height          =   315
  26.       Left            =   6600
  27.       TabIndex        =   2
  28.       Text            =   "Text3"
  29.       Top             =   180
  30.       Width           =   1575
  31.    End
  32.    Begin VB.TextBox TitleBox 
  33.       BeginProperty Font 
  34.          name            =   "MS Sans Serif"
  35.          charset         =   0
  36.          weight          =   700
  37.          size            =   8.25
  38.          underline       =   0   'False
  39.          italic          =   0   'False
  40.          strikethrough   =   0   'False
  41.       EndProperty
  42.       Height          =   315
  43.       Left            =   720
  44.       TabIndex        =   1
  45.       Top             =   180
  46.       Width           =   4095
  47.    End
  48.    Begin VB.TextBox Text1 
  49.       BeginProperty Font 
  50.          name            =   "MS Sans Serif"
  51.          charset         =   0
  52.          weight          =   700
  53.          size            =   8.25
  54.          underline       =   0   'False
  55.          italic          =   0   'False
  56.          strikethrough   =   0   'False
  57.       EndProperty
  58.       Height          =   435
  59.       Left            =   720
  60.       TabIndex        =   0
  61.       Text            =   "Text1"
  62.       Top             =   600
  63.       Width           =   7455
  64.    End
  65.    Begin MSComDlg.CommonDialog CommonDialog1 
  66.       Left            =   6930
  67.       Top             =   1170
  68.       _Version        =   65536
  69.       _ExtentX        =   847
  70.       _ExtentY        =   847
  71.       _StockProps     =   0
  72.    End
  73.    Begin MSGrid.Grid Grid1 
  74.       Height          =   4455
  75.       Left            =   60
  76.       TabIndex        =   5
  77.       Top             =   1140
  78.       Width           =   6375
  79.       _Version        =   65536
  80.       _ExtentX        =   11245
  81.       _ExtentY        =   7858
  82.       _StockProps     =   77
  83.       ForeColor       =   -2147483640
  84.       BackColor       =   16777215
  85.       Rows            =   201
  86.       Cols            =   36
  87.    End
  88.    Begin VB.Label Label2 
  89.       Caption         =   "Rows/Cols:"
  90.       BeginProperty Font 
  91.          name            =   "MS Sans Serif"
  92.          charset         =   0
  93.          weight          =   700
  94.          size            =   12
  95.          underline       =   0   'False
  96.          italic          =   0   'False
  97.          strikethrough   =   0   'False
  98.       EndProperty
  99.       ForeColor       =   &H00FF0000&
  100.       Height          =   315
  101.       Left            =   5040
  102.       TabIndex        =   4
  103.       Top             =   180
  104.       Width           =   1455
  105.    End
  106.    Begin VB.Label Label1 
  107.       Caption         =   "Title:"
  108.       BeginProperty Font 
  109.          name            =   "MS Sans Serif"
  110.          charset         =   0
  111.          weight          =   700
  112.          size            =   9.75
  113.          underline       =   0   'False
  114.          italic          =   0   'False
  115.          strikethrough   =   0   'False
  116.       EndProperty
  117.       ForeColor       =   &H00FF0000&
  118.       Height          =   315
  119.       Left            =   120
  120.       TabIndex        =   3
  121.       Top             =   180
  122.       Width           =   615
  123.    End
  124.    Begin VB.Menu File 
  125.       Caption         =   "File"
  126.       Begin VB.Menu FileOpen 
  127.          Caption         =   "Read VTX file..."
  128.       End
  129.       Begin VB.Menu FileSave 
  130.          Caption         =   "Write VTX file..."
  131.       End
  132.       Begin VB.Menu FSep1 
  133.          Caption         =   "-"
  134.       End
  135.       Begin VB.Menu RCD 
  136.          Caption         =   "Read Internal Chart Data..."
  137.       End
  138.       Begin VB.Menu WCD 
  139.          Caption         =   "Write Internal Chart Data..."
  140.       End
  141.       Begin VB.Menu FileClose 
  142.          Caption         =   "Close..."
  143.       End
  144.    End
  145.    Begin VB.Menu Refresh 
  146.       Caption         =   "Refresh"
  147.       Begin VB.Menu RCDG 
  148.          Caption         =   "Refresh Chart With Data Grid"
  149.       End
  150.    End
  151. Attribute VB_Name = "frmData"
  152. Attribute VB_Creatable = False
  153. Attribute VB_Exposed = False
  154. Option Explicit
  155. Private Sub FileClose_Click()
  156.     frmData.Hide
  157.     frmMain.show
  158. End Sub
  159. Private Sub FileOpen_Click()
  160.     Dim TheFileName$
  161.     On Error Resume Next
  162.     frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
  163.     frmMain.CommonDialog1.DialogTitle = "Open"
  164.     frmMain.CommonDialog1.flags = &H1000
  165.     frmMain.CommonDialog1.CancelError = True
  166.     frmMain.CommonDialog1.InitDir = App.Path
  167.     frmMain.CommonDialog1.Action = 1
  168.     If Err Then Exit Sub
  169.     TheFileName = frmMain.CommonDialog1.filename
  170.     Call QReadData(TheFileName)
  171. End Sub
  172. Private Sub FileSave_Click()
  173.     Dim theRow%, theCol%
  174.     Dim TheRowCount%, TheColCount%
  175.     On Error Resume Next
  176.     frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
  177.     frmMain.CommonDialog1.DialogTitle = "Save As"
  178.     frmMain.CommonDialog1.flags = &H2
  179.     frmMain.CommonDialog1.CancelError = True
  180.     frmMain.CommonDialog1.filename = Left$(GlobalFileName, Len(GlobalFileName) - 1) + "x"
  181.     frmMain.CommonDialog1.Action = 2
  182.     If Err Then Exit Sub
  183.     Open frmMain.CommonDialog1.filename For Output As #1
  184.     If Err Then
  185.         MsgBox "Can't open file: " + frmMain.CommonDialog1.filename
  186.         Exit Sub
  187.     End If
  188.     TheColCount = 1
  189.     TheRowCount = 1
  190.     For theRow = 1 To 200
  191.         For theCol = 1 To 10
  192.             Grid1.Row = theRow
  193.             Grid1.Col = theCol
  194.             If Len(Grid1.Text) > 0 Then
  195.                 If theCol > TheColCount Then TheColCount = theCol
  196.                 If theRow > TheRowCount Then TheRowCount = theRow
  197.             End If
  198.         Next theCol
  199.     Next theRow
  200.     ' Write the new file to disk
  201.     Dim Quote$
  202.     Quote = Chr$(34)
  203.     Print #1, Quote + "VisualTools Chart Data" + Quote
  204.     Print #1, Quote + "Title" + Quote, Quote + TitleBox.Text + Quote
  205.     Print #1, Quote + "Rows" + Quote, Str$(TheRowCount)
  206.     Print #1, Quote + "Cols" + Quote, Str$(TheColCount)
  207.     For theRow = 1 To TheRowCount
  208.         For theCol = 1 To TheColCount
  209.             Grid1.Row = theRow
  210.             Grid1.Col = theCol
  211.             Print #1, Format$(theRow, "##0"), Format$(theCol, "##0"), Quote + Grid1.Text + Quote
  212.         Next theCol
  213.     Next theRow
  214.     Close #1
  215. End Sub
  216. Private Sub Form_Activate()
  217.     Text1.SetFocus
  218. End Sub
  219. Private Sub Form_Load()
  220.     frmData.Height = 7200
  221.     frmData.Width = 9615
  222.     frmData.Top = 0
  223.     frmData.Left = 0
  224.     Text1.Text = Grid1.Text
  225.     Grid1.Row = 1
  226.     Grid1.Col = 1
  227. End Sub
  228. Private Sub Form_Resize()
  229.    Grid1.Width = ScaleWidth - 120
  230.    Grid1.Height = ScaleHeight - Text1.Top - Text1.Height - 150
  231. End Sub
  232. Private Sub Form_Unload(Cancel As Integer)
  233.     frmData.Hide
  234.     frmMain.show
  235.     Call RefreshChart
  236.     Cancel = 1
  237. End Sub
  238. Private Sub Grid1_SelChange()
  239.     Text1.Text = Grid1.Text
  240.     Text1.SetFocus
  241. End Sub
  242. Private Sub RCD_Click()
  243.    On Error GoTo FileReadError
  244.    With CommonDialog1
  245.       .DialogTitle = "Read First Impression Data"
  246.       .DefaultExt = "vtx"
  247.       .Filter = "First Impression Data|*.vtx"
  248.       .flags = &H1000
  249.       .CancelError = True
  250.       .InitDir = App.Path
  251.       .ShowOpen
  252.       
  253.       Call QReadData(.filename)
  254.    End With
  255.    Exit Sub
  256. FileReadError:
  257.    MsgBox Error
  258. End Sub
  259. Private Sub RCDG_Click()
  260.     Call RefreshChart
  261. End Sub
  262. Private Sub RefreshChart()
  263.     Dim TheRowCount%, TheColCount%, theRow%, theCol%
  264.     ' Dermine the new Row and Column count
  265.     TheRowCount = 1
  266.     TheColCount = 1
  267.     For theRow = 1 To 200
  268.         For theCol = 1 To 35
  269.             frmData.Grid1.Row = theRow
  270.             frmData.Grid1.Col = theCol
  271.             If frmData.Grid1.Text <> "" Then
  272.                 If theRow > TheRowCount Then TheRowCount = theRow
  273.                 If theCol > TheColCount Then TheColCount = theCol
  274.             End If
  275.         Next theCol
  276.     Next theRow
  277.     Call QGridToChart(TheRowCount, TheColCount)
  278. End Sub
  279. Private Sub Text1_KeyPress(KeyAscii As Integer)
  280.     If KeyAscii = 13 Then
  281.         Grid1.Text = Text1.Text
  282.         KeyAscii = 0
  283.     End If
  284. End Sub
  285. Private Sub WCD_Click()
  286.     ' Write the data in the chart to a file
  287.     Call QWriteData
  288. End Sub
  289.