home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmData
- Caption = "First Impression Formatting Example 2"
- ClientHeight = 5715
- ClientLeft = 2100
- ClientTop = 5205
- ClientWidth = 8610
- Height = 6465
- Left = 2010
- LinkTopic = "Form1"
- ScaleHeight = 5715
- ScaleWidth = 8610
- Top = 4545
- Width = 8790
- Begin VB.TextBox Text2
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 6600
- TabIndex = 2
- Text = "Text3"
- Top = 180
- Width = 1575
- End
- Begin VB.TextBox TitleBox
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 315
- Left = 720
- TabIndex = 1
- Top = 180
- Width = 4095
- End
- Begin VB.TextBox Text1
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 435
- Left = 720
- TabIndex = 0
- Text = "Text1"
- Top = 600
- Width = 7455
- End
- Begin MSComDlg.CommonDialog CommonDialog1
- Left = 6930
- Top = 1170
- _Version = 65536
- _ExtentX = 847
- _ExtentY = 847
- _StockProps = 0
- End
- Begin MSGrid.Grid Grid1
- Height = 4455
- Left = 60
- TabIndex = 5
- Top = 1140
- Width = 6375
- _Version = 65536
- _ExtentX = 11245
- _ExtentY = 7858
- _StockProps = 77
- ForeColor = -2147483640
- BackColor = 16777215
- Rows = 201
- Cols = 36
- End
- Begin VB.Label Label2
- Caption = "Rows/Cols:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 12
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FF0000&
- Height = 315
- Left = 5040
- TabIndex = 4
- Top = 180
- Width = 1455
- End
- Begin VB.Label Label1
- Caption = "Title:"
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 0
- weight = 700
- size = 9.75
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- ForeColor = &H00FF0000&
- Height = 315
- Left = 120
- TabIndex = 3
- Top = 180
- Width = 615
- End
- Begin VB.Menu File
- Caption = "File"
- Begin VB.Menu FileOpen
- Caption = "Read VTX file..."
- End
- Begin VB.Menu FileSave
- Caption = "Write VTX file..."
- End
- Begin VB.Menu FSep1
- Caption = "-"
- End
- Begin VB.Menu RCD
- Caption = "Read Internal Chart Data..."
- End
- Begin VB.Menu WCD
- Caption = "Write Internal Chart Data..."
- End
- Begin VB.Menu FileClose
- Caption = "Close..."
- End
- End
- Begin VB.Menu Refresh
- Caption = "Refresh"
- Begin VB.Menu RCDG
- Caption = "Refresh Chart With Data Grid"
- End
- End
- Attribute VB_Name = "frmData"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Option Explicit
- Private Sub FileClose_Click()
- frmData.Hide
- frmMain.show
- End Sub
- Private Sub FileOpen_Click()
- Dim TheFileName$
- On Error Resume Next
- frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
- frmMain.CommonDialog1.DialogTitle = "Open"
- frmMain.CommonDialog1.flags = &H1000
- frmMain.CommonDialog1.CancelError = True
- frmMain.CommonDialog1.InitDir = App.Path
- frmMain.CommonDialog1.Action = 1
- If Err Then Exit Sub
- TheFileName = frmMain.CommonDialog1.filename
- Call QReadData(TheFileName)
- End Sub
- Private Sub FileSave_Click()
- Dim theRow%, theCol%
- Dim TheRowCount%, TheColCount%
- On Error Resume Next
- frmMain.CommonDialog1.Filter = "(*.vtx)|*.vtx"
- frmMain.CommonDialog1.DialogTitle = "Save As"
- frmMain.CommonDialog1.flags = &H2
- frmMain.CommonDialog1.CancelError = True
- frmMain.CommonDialog1.filename = Left$(GlobalFileName, Len(GlobalFileName) - 1) + "x"
- frmMain.CommonDialog1.Action = 2
- If Err Then Exit Sub
- Open frmMain.CommonDialog1.filename For Output As #1
- If Err Then
- MsgBox "Can't open file: " + frmMain.CommonDialog1.filename
- Exit Sub
- End If
- TheColCount = 1
- TheRowCount = 1
- For theRow = 1 To 200
- For theCol = 1 To 10
- Grid1.Row = theRow
- Grid1.Col = theCol
- If Len(Grid1.Text) > 0 Then
- If theCol > TheColCount Then TheColCount = theCol
- If theRow > TheRowCount Then TheRowCount = theRow
- End If
- Next theCol
- Next theRow
- ' Write the new file to disk
- Dim Quote$
- Quote = Chr$(34)
- Print #1, Quote + "VisualTools Chart Data" + Quote
- Print #1, Quote + "Title" + Quote, Quote + TitleBox.Text + Quote
- Print #1, Quote + "Rows" + Quote, Str$(TheRowCount)
- Print #1, Quote + "Cols" + Quote, Str$(TheColCount)
- For theRow = 1 To TheRowCount
- For theCol = 1 To TheColCount
- Grid1.Row = theRow
- Grid1.Col = theCol
- Print #1, Format$(theRow, "##0"), Format$(theCol, "##0"), Quote + Grid1.Text + Quote
- Next theCol
- Next theRow
- Close #1
- End Sub
- Private Sub Form_Activate()
- Text1.SetFocus
- End Sub
- Private Sub Form_Load()
- frmData.Height = 7200
- frmData.Width = 9615
- frmData.Top = 0
- frmData.Left = 0
- Text1.Text = Grid1.Text
- Grid1.Row = 1
- Grid1.Col = 1
- End Sub
- Private Sub Form_Resize()
- Grid1.Width = ScaleWidth - 120
- Grid1.Height = ScaleHeight - Text1.Top - Text1.Height - 150
- End Sub
- Private Sub Form_Unload(Cancel As Integer)
- frmData.Hide
- frmMain.show
- Call RefreshChart
- Cancel = 1
- End Sub
- Private Sub Grid1_SelChange()
- Text1.Text = Grid1.Text
- Text1.SetFocus
- End Sub
- Private Sub RCD_Click()
- On Error GoTo FileReadError
- With CommonDialog1
- .DialogTitle = "Read First Impression Data"
- .DefaultExt = "vtx"
- .Filter = "First Impression Data|*.vtx"
- .flags = &H1000
- .CancelError = True
- .InitDir = App.Path
- .ShowOpen
-
- Call QReadData(.filename)
- End With
- Exit Sub
- FileReadError:
- MsgBox Error
- End Sub
- Private Sub RCDG_Click()
- Call RefreshChart
- End Sub
- Private Sub RefreshChart()
- Dim TheRowCount%, TheColCount%, theRow%, theCol%
- ' Dermine the new Row and Column count
- TheRowCount = 1
- TheColCount = 1
- For theRow = 1 To 200
- For theCol = 1 To 35
- frmData.Grid1.Row = theRow
- frmData.Grid1.Col = theCol
- If frmData.Grid1.Text <> "" Then
- If theRow > TheRowCount Then TheRowCount = theRow
- If theCol > TheColCount Then TheColCount = theCol
- End If
- Next theCol
- Next theRow
- Call QGridToChart(TheRowCount, TheColCount)
- End Sub
- Private Sub Text1_KeyPress(KeyAscii As Integer)
- If KeyAscii = 13 Then
- Grid1.Text = Text1.Text
- KeyAscii = 0
- End If
- End Sub
- Private Sub WCD_Click()
- ' Write the data in the chart to a file
- Call QWriteData
- End Sub
-