home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / test_lay / testlay.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-05-18  |  5.2 KB  |  168 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Test Grid Save Layout"
  6.    ClientHeight    =   3960
  7.    ClientLeft      =   2145
  8.    ClientTop       =   2445
  9.    ClientWidth     =   7830
  10.    Height          =   4650
  11.    Icon            =   TESTLAY.FRX:0000
  12.    Left            =   2085
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   3960
  15.    ScaleWidth      =   7830
  16.    Top             =   1815
  17.    Width           =   7950
  18.    Begin TrueGrid Table1 
  19.       AllowArrows     =   -1  'True
  20.       AllowTabs       =   -1  'True
  21.       BackColor       =   &H00C0C0C0&
  22.       DataSource      =   "Data1"
  23.       Editable        =   -1  'True
  24.       EditDropDown    =   -1  'True
  25.       ExposeCellMode  =   0  'Expose upon selection
  26.       FetchMode       =   0  'By cell
  27.       HeadingHeight   =   1
  28.       Height          =   3420
  29.       HorzLines       =   2  '3D
  30.       Layout          =   TESTLAY.FRX:0302
  31.       LayoutIndex     =   1
  32.       Left            =   120
  33.       LinesPerRow     =   1
  34.       MarqueeUnique   =   -1  'True
  35.       SplitPropsGlobal=   -1  'True
  36.       SplitTabMode    =   0  'Don't tab across splits
  37.       TabCapture      =   0   'False
  38.       TabIndex        =   0
  39.       Top             =   90
  40.       UseBookmarks    =   -1  'True
  41.       Width           =   7605
  42.       WrapCellPointer =   0   'False
  43.    End
  44.    Begin Data Data1 
  45.       Caption         =   "Data1"
  46.       Connect         =   ""
  47.       DatabaseName    =   "R:\TEST\TESTLAY.MDB"
  48.       Exclusive       =   0   'False
  49.       Height          =   270
  50.       Left            =   120
  51.       Options         =   0
  52.       ReadOnly        =   0   'False
  53.       RecordSource    =   "TestLay"
  54.       Top             =   3600
  55.       Width           =   7590
  56.    End
  57.    Begin Menu MenuExit 
  58.       Caption         =   "E&xit"
  59.    End
  60.    Begin Menu MenuSaveLayout 
  61.       Caption         =   "&Save Layout"
  62.       Begin Menu MenuSaveLayoutFactory 
  63.          Caption         =   "as &Factory"
  64.       End
  65.       Begin Menu MenuSaveLayoutCurrent 
  66.          Caption         =   "as &Current"
  67.       End
  68.    End
  69.    Begin Menu MenuRestoreLayout 
  70.       Caption         =   "&Restore Layout"
  71.       Begin Menu MenuRestoreLayoutFactory 
  72.          Caption         =   "from &Factory"
  73.       End
  74.       Begin Menu MenuRestoreLayoutCurrent 
  75.          Caption         =   "from &Current"
  76.       End
  77.    End
  78.    Begin Menu MenuAdd 
  79.       Caption         =   "&Add Record"
  80.    End
  81.    Begin Menu MenuDelete 
  82.       Caption         =   "&Delete Record"
  83.    End
  84. ' TestLay.Frm
  85. ' 94/05/06 Copyright 1994, Larry Rebich, The Bridge, Inc.
  86.     Option Explicit
  87.     DefInt A-Z
  88.     Dim InFormLoad As Integer   'skip some things during form load
  89.     Dim Elap As Double  'time to perform save and get
  90. Sub DoData1Caption ()
  91. '    Dim sd As Long          'seconds per day
  92.     Dim sc As Double        'seconds in elapsed
  93. '    sd = 24& * 60& * 60&
  94.     sc = 86400 * Elap
  95.     Data1.Caption = " " & Format$(sc, "#0.0######") & " seconds to perform Save or Get Grid."
  96. End Sub
  97. Sub Form_Load ()
  98.     Dim a As String         'applications path
  99.     InFormLoad = True
  100.     CenterForm Me, 0, 0     'center the form
  101.     a = App.Path            'get our path
  102.     a = AddBackSlash(a)     'add backslash if needed
  103.     GridPathAndFileName = a & GridFileName  'layout file
  104.     Data1.DatabaseName = a & GridDBName     'database name
  105.     MenuSaveLayoutFactory_Click 'save design layout as factory layout
  106.     MenuSaveLayoutFactory.Visible = False
  107.     Data1.Caption = ""
  108.     InFormLoad = False
  109. End Sub
  110. Sub MenuAdd_Click ()
  111.     Table1_Append
  112. End Sub
  113. Sub MenuDelete_Click ()
  114.     If MsgBox("Delete record?", 1 + 32) = 2 Then Exit Sub
  115.     Data1.Recordset.Delete
  116. End Sub
  117. Sub MenuExit_Click ()
  118. End Sub
  119. Sub MenuRestoreLayoutCurrent_Click ()
  120.     Dim Rtn As Integer
  121.     Elap = Now
  122.     Rtn = GridGetLayout(GridPathAndFileName, GridForTable, GridCurrent, Table1)
  123.     Elap = Now - Elap       'duration
  124.     If Not Rtn Then
  125.     MsgBox "Saved Current layout is the same as the current layout!", 48, "Current Layout Not Restored"
  126.     Else
  127.     DoData1Caption
  128.     End If
  129. End Sub
  130. Sub MenuRestoreLayoutFactory_Click ()
  131.     Dim Rtn As Integer
  132.     Elap = Now
  133.     Rtn = GridGetLayout(GridPathAndFileName, GridForTable, GridFactory, Table1)
  134.     Elap = Now - Elap
  135.     If Not Rtn Then
  136.     MsgBox "Saved Factory layout is the same as the current layout!", 48, "Factory Layout Not Restored"
  137.     Else
  138.     DoData1Caption
  139.     End If
  140. End Sub
  141. Sub MenuSaveLayoutCurrent_Click ()
  142.     Dim Rtn As Integer
  143.     Elap = Now
  144.     Rtn = GridSaveLayout(GridPathAndFileName, GridForTable, GridCurrent, Table1)
  145.     Elap = Now - Elap
  146.     If Not Rtn Then
  147.     MsgBox "Saved Current layout is the same as the current layout!", 48, "Current Layout Not Saved"
  148.     Else
  149.     DoData1Caption
  150.     End If
  151. End Sub
  152. Sub MenuSaveLayoutFactory_Click ()
  153.     Dim Rtn As Integer
  154.     Elap = Now
  155.     Rtn = GridSaveLayout(GridPathAndFileName, GridForTable, GridFactory, Table1)
  156.     If InFormLoad Then Exit Sub
  157.     Elap = Now - Elap
  158.     If Not Rtn Then
  159.     MsgBox "Saved Factory layout is the same as the current layout!", 48, "Factory Layout Not Saved"
  160.     Else
  161.     DoData1Caption
  162.     End If
  163. End Sub
  164. Sub Table1_Append ()
  165.     If MsgBox("Add new record?", 1 + 32) = 2 Then Exit Sub
  166.     Data1.Recordset.AddNew
  167. End Sub
  168.