Content Supported by Sourcelens Consulting

VERSION 5.00
Begin VB.PropertyPage SLGeneral 
   Caption         =   "General"
   ClientHeight    =   3495
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5925
   PaletteMode     =   0  'Halftone
   ScaleHeight     =   3495
   ScaleWidth      =   5925
   Begin VB.CheckBox chkEnabled 
      Caption         =   "Enabled"
      Height          =   285
      Left            =   90
      TabIndex        =   4
      Top             =   1420
      Width           =   2700
   End
   Begin VB.TextBox txtCaption 
      Height          =   330
      Left            =   90
      TabIndex        =   3
      Top             =   1020
      Width           =   2700
   End
   Begin VB.TextBox txtBorderWidth 
      Height          =   330
      Left            =   90
      TabIndex        =   1
      Top             =   370
      Width           =   765
   End
   Begin VB.ComboBox cboAlignment 
      Height          =   315
      Left            =   120
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   2056
      Width           =   2655
   End
   Begin VB.Label Label1 
      Caption         =   "Alignment"
      Height          =   240
      Left            =   120
      TabIndex        =   6
      Top             =   1800
      Width           =   2700
   End
   Begin VB.Label lblCaption 
      Caption         =   "Caption:"
      Height          =   240
      Left            =   90
      TabIndex        =   2
      Top             =   770
      Width           =   2700
   End
   Begin VB.Label lblBorderWidth 
      Caption         =   "BorderWidth:"
      Height          =   240
      Left            =   90
      TabIndex        =   0
      Top             =   120
      Width           =   2700
   End
End
Attribute VB_Name = "SLGeneral"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Explicit
' m_blnInSelectionChanged flag prevents the
'   initial loading of property values in
'   the SelectionChanged event from setting
'   Changed = True for all the properties
'   on the page.
Private m_blnInSelectionChanged As Boolean

Private Sub cboAlignment_Click()
    If Not m_blnInSelectionChanged Then Changed = True
End Sub

Private Sub chkEnabled_Click()
    If Not m_blnInSelectionChanged Then Changed = True
End Sub

Private Sub txtBorderWidth_KeyPress(KeyAscii As Integer)
    ' Restrict keystrokes to the digits
    '   (0 - 9) and the backspace.
    Select Case KeyAscii
        Case 48 To 57, 8
        Case Else
            Beep
            KeyAscii = 0
    End Select
End Sub

Private Sub txtCaption_Change()
    If Not m_blnInSelectionChanged Then Changed = True
End Sub

Private Sub txtBorderWidth_Change()
    If Not m_blnInSelectionChanged Then Changed = True
End Sub

Private Sub PropertyPage_ApplyChanges()
    Dim intCt As Integer
    Dim objBadValue As Object
    
    ' Properties that only make sense to
    '   set for the first selected
    '   control:
    SelectedControls(0).Caption = txtCaption.Text
    
    ' Properties that make sense to set
    '   for all the selected controls:
    For intCt = 0 To SelectedControls.Count - 1
        SelectedControls(intCt).Alignment = cboAlignment.ListIndex
        SelectedControls(intCt).Enabled = (chkEnabled.Value = vbChecked)
        SelectedControls(intCt).BorderWidth = txtBorderWidth.Text
    Next
End Sub

Private Sub PropertyPage_SelectionChanged()
    m_blnInSelectionChanged = True
    
    ' Set up values for drop downs.  (Do not
    '   do this in the Initialize event.)
    '
    ' Alignment:  Add in order of enum values,
    '   so the index equals the enum value.
    cboAlignment.Clear
    cboAlignment.AddItem vbLeftJustify & " - vbLeftJustify", vbLeftJustify
    cboAlignment.AddItem vbRightJustify & " - vbRightJustify", vbRightJustify
    cboAlignment.AddItem vbCenter & " - vbCenter", vbCenter
    
    ' Read values to display.  Use value from
    '   first selected control.
    chkEnabled.Value = (SelectedControls(0).Enabled And vbChecked)
    txtCaption.Text = SelectedControls(0).Caption
    txtBorderWidth.Text = SelectedControls(0).BorderWidth
    cboAlignment.ListIndex = SelectedControls(0).Alignment
    
    m_blnInSelectionChanged = False
End Sub