home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / arrays / vsflex / outline.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-06-15  |  5.3 KB  |  160 lines

  1. VERSION 2.00
  2. Begin Form fOutline 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "VSFlex Outline"
  6.    ClientHeight    =   5490
  7.    ClientLeft      =   390
  8.    ClientTop       =   990
  9.    ClientWidth     =   8040
  10.    Height          =   5895
  11.    Left            =   330
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   5490
  14.    ScaleWidth      =   8040
  15.    Top             =   645
  16.    Width           =   8160
  17.    Begin CommandButton Command1 
  18.       BackColor       =   &H00C0C0C0&
  19.       Caption         =   "Hint"
  20.       FontBold        =   0   'False
  21.       FontItalic      =   0   'False
  22.       FontName        =   "MS Sans Serif"
  23.       FontSize        =   8.25
  24.       FontStrikethru  =   0   'False
  25.       FontUnderline   =   0   'False
  26.       Height          =   300
  27.       Left            =   6315
  28.       TabIndex        =   2
  29.       Top             =   5025
  30.       Width           =   1185
  31.    End
  32.    Begin vsFlexArray fa 
  33.       BackColor       =   &H0080FFFF&
  34.       BackColorBkg    =   &H0080FFFF&
  35.       BackColorFixed  =   &H00C0C0C0&
  36.       BorderStyle     =   0  'None
  37.       Cols            =   4
  38.       FillStyle       =   1  'Repeat
  39.       FixedCols       =   0
  40.       FocusRect       =   0  'None
  41.       FontBold        =   0   'False
  42.       FontItalic      =   0   'False
  43.       FontName        =   "Arial"
  44.       FontSize        =   13.5
  45.       FontStrikethru  =   0   'False
  46.       FontUnderline   =   0   'False
  47.       ForeColor       =   &H00000000&
  48.       FormatString    =   "^     |Description                  |>Date               |>Amount                 "
  49.       GridLines       =   0  'None
  50.       Height          =   4035
  51.       HighLight       =   0  'Never
  52.       Left            =   180
  53.       SelectionMode   =   1  'By Row
  54.       TabIndex        =   0
  55.       Top             =   855
  56.       Width           =   7575
  57.    End
  58.    Begin Label Label1 
  59.       Alignment       =   2  'Center
  60.       BackColor       =   &H00000000&
  61.       Caption         =   "Travel Expense Outline"
  62.       FontBold        =   -1  'True
  63.       FontItalic      =   0   'False
  64.       FontName        =   "Arial"
  65.       FontSize        =   24
  66.       FontStrikethru  =   0   'False
  67.       FontUnderline   =   0   'False
  68.       ForeColor       =   &H00FFFF00&
  69.       Height          =   615
  70.       Left            =   225
  71.       TabIndex        =   1
  72.       Top             =   120
  73.       Width           =   7485
  74.    End
  75. Option Explicit
  76. ' Demo Goals
  77. Sub Command1_Click ()
  78.    MsgBox "Double-click on the category line to collapse or expand the items"
  79. End Sub
  80. Sub DoFillData ()
  81.   Dim t$, s$, tot%
  82.   t = Chr(9)
  83.   fa.Rows = 1
  84.   fa.AddItem "*" + t + "Air Fare"
  85.   fa.AddItem "" + t + "SFO-JFK" + t + "April 14" + t + Format$(Rnd * 500, "###.00")
  86.   fa.AddItem "" + t + "JFK-JFK" + t + "April 18" + t + Format$(Rnd * 500, "###.00")
  87.   fa.AddItem "" + t + "SFO-OAK" + t + "April 24" + t + Format$(Rnd * 500, "###.00")
  88.   fa.AddItem "" + t + "OAK-SFO" + t + "April 27" + t + Format$(Rnd * 500, "###.00")
  89.   fa.AddItem "*" + t + "Meals"
  90.   fa.AddItem "" + t + "Bad service BBQ" + t + "April 14" + t + "35.00"
  91.   fa.AddItem "" + t + "The flying dish" + t + "April 15" + t + "135.00"
  92.   fa.AddItem "" + t + "Indigestion Cafe" + t + "April 17" + t + "45.00"
  93.   fa.AddItem "*" + t + "Hotel"
  94.   fa.AddItem "" + t + "Bates Motel" + t + "April 14" + t + "817.00"
  95.   fa.AddItem "" + t + "Nightmare Inn" + t + "April 15" + t + "117.00"
  96.   fa.AddItem "" + t + "Rats & Breakfast" + t + "April 25" + t + "17.00"
  97. End Sub
  98. Sub DoTotals ()
  99.   Dim i%, tot%
  100.   For i = fa.Rows - 1 To 0 Step -1
  101.     If fa.TextArray(i * fa.Cols) = "" Then
  102.       tot = tot + Val(fa.TextArray(i * fa.Cols + 3))
  103.     Else
  104.       fa.Row = i
  105.       fa.Col = 0
  106.       fa.ColSel = fa.Cols - 1
  107.       fa.CellBackColor = 1           ' black
  108.       fa.CellForeColor = &HFFFF&     ' yellow
  109.       fa.CellFontBold = True
  110.       fa.CellFontWidth = 8
  111.       fa.TextArray(i * fa.Cols + 3) = Format(tot, "##.00")
  112.       tot = 0
  113.     End If
  114.   Next
  115. End Sub
  116. Sub fa_DblClick ()
  117.     Dim i%, r%
  118.     ' find field to collapse or expand
  119.     r = fa.MouseRow
  120.     If r < 1 Then Exit Sub
  121.     While r > 0 And fa.TextArray(r * fa.Cols) = ""
  122.         r = r - 1
  123.     Wend
  124.     ' show symbol
  125.     If fa.TextArray(r * fa.Cols) = "*" Then
  126.         fa.TextArray(r * fa.Cols) = "+"
  127.     Else
  128.         fa.TextArray(r * fa.Cols) = "*"
  129.     End If
  130.     ' collapse this guy
  131.     r = r + 1
  132.     If fa.RowHeight(r) = 0 Then
  133.         While r < fa.Rows - 1 And fa.TextArray(r * fa.Cols) = ""
  134.             fa.RowHeight(r) = -1
  135.             r = r + 1
  136.         Wend
  137.         If r = fa.Rows - 1 And fa.TextArray(r * fa.Cols) = "" Then fa.RowHeight(r) = -1
  138.     Else
  139.         While r < fa.Rows - 1 And fa.TextArray(r * fa.Cols) = ""
  140.             fa.RowHeight(r) = 0
  141.             r = r + 1
  142.         Wend
  143.         If r = fa.Rows - 1 And fa.TextArray(r * fa.Cols) = "" Then fa.RowHeight(r) = 0
  144.     End If
  145. End Sub
  146. Sub Form_Load ()
  147.   DoFillData
  148.   DoTotals
  149.   fa.Col = 1
  150.   fa.Row = 1
  151.   fa.ColSel = fa.Cols - 1
  152. End Sub
  153. Sub Form_Resize ()
  154.    ' Dim sz!
  155.    ' sz = scalewidth - 2 * fa.Left
  156.    ' If sz > 0 Then fa.Width = sz
  157.    ' sz = scaleheight - fa.Top - fa.Left
  158.    ' If sz > 0 Then fa.Height = sz
  159. End Sub
  160.