VERSION 2.00
Begin Form frmSelectLook 
   BackColor       =   &H00C0C0C0&
   BorderStyle     =   3  'Fixed Double
   ClientHeight    =   2760
   ClientLeft      =   6690
   ClientTop       =   1920
   ClientWidth     =   4455
   Height          =   3165
   Left            =   6630
   LinkTopic       =   "Form5"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2760
   ScaleWidth      =   4455
   Top             =   1575
   Width           =   4575
   Begin SSFrame Frame3D3 
      Caption         =   "Orientation"
      Font3D          =   0  'None
      Height          =   855
      Left            =   120
      TabIndex        =   8
      Top             =   1200
      Width           =   2055
      Begin SSOption btnLandscape 
         Caption         =   "&Landscape"
         Font3D          =   0  'None
         Height          =   315
         Left            =   120
         TabIndex        =   11
         TabStop         =   0   'False
         Top             =   480
         Width           =   1695
      End
      Begin SSOption btnPortrait 
         Caption         =   "Po&rtrait"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Value           =   -1  'True
         Width           =   1215
      End
   End
   Begin SSFrame Frame3D2 
      Caption         =   "Options"
      Font3D          =   0  'None
      Height          =   1575
      Left            =   2280
      TabIndex        =   6
      Top             =   360
      Width           =   2055
      Begin SSCheck ctlResize 
         Caption         =   "Fi&t in Grid"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   16
         Top             =   1200
         Value           =   -1  'True
         Width           =   1455
      End
      Begin SSCheck ctlProperties 
         Caption         =   "&Properties"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   15
         Top             =   960
         Value           =   -1  'True
         Width           =   1455
      End
      Begin SSCheck ctlGridlines 
         Caption         =   "&Gridlines"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   720
         Value           =   -1  'True
         Width           =   1455
      End
      Begin SSCheck ctlFooter 
         Caption         =   "&Footer"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   480
         Value           =   -1  'True
         Width           =   1575
      End
      Begin SSCheck ctlHeader 
         Caption         =   "&Header"
         Font3D          =   0  'None
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   240
         Value           =   -1  'True
         Width           =   1575
      End
   End
   Begin SSFrame Frame3D1 
      Caption         =   "Masters Per Page"
      Font3D          =   0  'None
      Height          =   735
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   2055
      Begin ComboBox ctlMastersPerPage 
         Height          =   300
         Left            =   600
         Style           =   2  'Dropdown List
         TabIndex        =   9
         Top             =   300
         Width           =   855
      End
   End
   Begin PictureBox Picture1 
      BackColor       =   &H00C0C0C0&
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   -240
      ScaleHeight     =   615
      ScaleWidth      =   5055
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   2160
      Width           =   5055
      Begin CommandButton Previous 
         Caption         =   "<"
         Height          =   375
         Left            =   3240
         TabIndex        =   4
         Top             =   120
         Width           =   495
      End
      Begin CommandButton Next 
         BackColor       =   &H00C0C0C0&
         Caption         =   "&Next >"
         Default         =   -1  'True
         Height          =   375
         Left            =   3720
         TabIndex        =   2
         Top             =   120
         Width           =   855
      End
      Begin CommandButton Cancel 
         Caption         =   "&Cancel"
         Height          =   375
         Left            =   1800
         TabIndex        =   7
         Top             =   120
         Width           =   975
      End
      Begin CommandButton First 
         Caption         =   "|<<"
         Height          =   375
         Left            =   2760
         TabIndex        =   5
         Top             =   120
         Width           =   495
      End
   End
   Begin Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "What kind of look do you want for your report?"
      ForeColor       =   &H00404040&
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4215
   End
End
Option Explicit

Sub btnLandscape_Click (index As Integer)
    If pageIsPortrait(gPageBack) Then
        pageOrientSwitch gPageBack
    End If
End Sub

Sub btnPortrait_Click (index As Integer)
    If pageIsLandscape(gPageBack) Then
        pageOrientSwitch gPageBack
    End If
End Sub

Sub Cancel_Click ()
    End
End Sub

Sub First_Click ()
    Hide
    frmSelectStencil.Show
End Sub

Sub Form_Load ()
    Dim s, t
    Dim sBegin, sEnd

    ' Initialize form.
    '
    formInit frmSelectLook

    ' Initialize controls
    '
    ' - Options
    '
    ctlHeader.Value = gDoc.Header
    ctlFooter.Value = gDoc.Footer
    ctlGridlines.Value = gDoc.gridlines
    ctlProperties.Value = gDoc.properties
    ctlResize.Value = gDoc.resize

    ' - Orientation
    '
    If pageIsPortrait(gPageBack) Then
        btnPortrait.Value = True
    Else
        btnLandscape.Value = True
    End If

    ' - Masters Per Page
    '
    s = ""
    s = s & "1 x 1,1 x 2,1 x 3,1 x 4,1 x 5,1 x 6,"
    s = s & "2 x 2,2 x 3,2 x 4,2 x 5,2 x 6,"
    s = s & "3 x 3,3 x 4,3 x 5,3 x 6,"
    s = s & "4 x 4,4 x 5,4 x 6,"
    s = s & "5 x 5,5 x 6,"
    s = s & "6 x 6,"

    sEnd = 0
    Do
        sBegin = sEnd
        sEnd = InStr(sBegin + 1, s, ",")
        If sEnd = 0 Then
            Exit Do
        End If
        t = Mid(s, sBegin + 1, sEnd - sBegin - 1)
        ctlMastersPerPage.AddItem t
    Loop
    ctlMastersPerPage.ListIndex = 12    ' 3 x 4
    
End Sub

Sub Form_QueryUnload (Cancel As Integer, UnloadMode As Integer)
    End
End Sub

Function formValid ()
    Dim stat
    Dim masters
    Dim rows
    Dim cols

    formValid = True        ' default value

    ' Options
    '
    gDoc.Header = ctlHeader.Value
    gDoc.Footer = ctlFooter.Value
    gDoc.gridlines = ctlGridlines.Value
    gDoc.properties = ctlProperties.Value
    gDoc.resize = ctlResize.Value

    ' Get number of masters per page
    '
    masters = ctlMastersPerPage.Text
    rows = Val(Left(masters, 1))
    cols = Val(Right(masters, 1))

    ' Compute grid metrics
    '
    gridCompute rows, cols

End Function

Sub Last_Click ()
    If formValid() = True Then
        Hide
        frmReport.Show
    End If
End Sub

Sub Next_Click ()
    If formValid() = True Then
        Hide
        frmReport.Show
    End If
End Sub

Sub Previous_Click ()
    Hide
    frmSelectStencil.Show
End Sub

