B
Bill Stanton
My intuitive sense tells me that the functional portion of the
segment of code, headed by the "block comments" below,
can be greately simplyfied and reduced.
Maybe something like: (I don't know how to declare the
data type for SelMedia so that it can be used to make reference
to the form's label controls whose name is passed to MediaSelect?)
Public Function MediaSelect(SelMedia As String)
Call SetMediaFocus(SelMedia, 14, 700) 'Highlight selection
Call SetMediaFocus(CurMedia, 11, 400) 'Remove highlighting from old
selection
CurMedia = SelMedia 'Make selection
End Function
Private Sub SetMediaFocus(SelCntl As ?????, PtSize As Integer, Weight As
Integer)
Me.SelCntl.FontSize = PtSize
Me.SelCntl.FontWeight = Weight
End Sub
Public Function MediaSelect(SelMedia As String)
'=====================================================
' The user is required to identify the media associated with the volume
before
' answering the question as to whether the volume is new or existing. The
eight
' media options displayed at opening are set to a point size of 11 and
weight of
' "Normal", i.e., 400. This function is invoked by clicking upon one of the
label
' boxes whose "On Click" event contains the invocation expression that
identifies
' the media, e.g., the label control for "Cassette" is named "SelCA". Thus,
we
' effectively give the functionality focus to whatever media is detected and
signify
' that by setting its point-size and weight to 14/Bold and revert the
previously
' selected media to its nominal settings. In other words we highlight to
show focus.
'=====================================================
Select Case SelMedia 'Set selected option point size to 14 and font weight
to "Bold".
Case "SelCA"
Me.SelCAS.FontSize = 14
Me.SelCAS.FontWeight = 700
Case "SelCD"
Me.SelCD.FontSize = 14
Me.SelCD.FontWeight = 700
Case "SelCD2pl"
Me.SelCD2pl.FontSize = 14
Me.SelCD2pl.FontWeight = 700
Case "SelDVD"
Me.SelDVD.FontSize = 14
Me.SelDVD.FontWeight = 700
Case "SelRR7"
Me.SelRR7.FontSize = 14
Me.SelRR7.FontWeight = 700
Case "SelRR10"
Me.SelRR10.FontSize = 14
Me.SelRR10.FontWeight = 700
Case "SelVy10"
Me.SelVy10.FontSize = 14
Me.SelVy10.FontWeight = 700
Case "SelVy12"
Me.SelVy12.FontSize = 14
Me.SelVy12.FontWeight = 700
End Select
Select Case CurMedia 'Set previously selected media to its nominal display
properties.
Case "SelCA"
Me.SelCAS.FontSize = 11
Me.SelCAS.FontWeight = 400
Case "SelCD"
Me.SelCD.FontSize = 11
Me.SelCD.FontWeight = 400
Case "SelCD2pl"
Me.SelCD2pl.FontSize = 11
Me.SelCD2pl.FontWeight = 400
Case "SelDVD"
Me.SelDVD.FontSize = 11
Me.SelDVD.FontWeight = 400
Case "SelRR7"
Me.SelRR7.FontSize = 11
Me.SelRR7.FontWeight = 400
Case "SelRR10"
Me.SelRR10.FontSize = 11
Me.SelRR10.FontWeight = 400
Case "SelVy10"
Me.SelVy10.FontSize = 11
Me.SelVy10.FontWeight = 400
Case "SelVy12"
Me.SelVy12.FontSize = 11
Me.SelVy12.FontWeight = 400
End Select
CurMedia = SelMedia
End Function
segment of code, headed by the "block comments" below,
can be greately simplyfied and reduced.
Maybe something like: (I don't know how to declare the
data type for SelMedia so that it can be used to make reference
to the form's label controls whose name is passed to MediaSelect?)
Public Function MediaSelect(SelMedia As String)
Call SetMediaFocus(SelMedia, 14, 700) 'Highlight selection
Call SetMediaFocus(CurMedia, 11, 400) 'Remove highlighting from old
selection
CurMedia = SelMedia 'Make selection
End Function
Private Sub SetMediaFocus(SelCntl As ?????, PtSize As Integer, Weight As
Integer)
Me.SelCntl.FontSize = PtSize
Me.SelCntl.FontWeight = Weight
End Sub
Public Function MediaSelect(SelMedia As String)
'=====================================================
' The user is required to identify the media associated with the volume
before
' answering the question as to whether the volume is new or existing. The
eight
' media options displayed at opening are set to a point size of 11 and
weight of
' "Normal", i.e., 400. This function is invoked by clicking upon one of the
label
' boxes whose "On Click" event contains the invocation expression that
identifies
' the media, e.g., the label control for "Cassette" is named "SelCA". Thus,
we
' effectively give the functionality focus to whatever media is detected and
signify
' that by setting its point-size and weight to 14/Bold and revert the
previously
' selected media to its nominal settings. In other words we highlight to
show focus.
'=====================================================
Select Case SelMedia 'Set selected option point size to 14 and font weight
to "Bold".
Case "SelCA"
Me.SelCAS.FontSize = 14
Me.SelCAS.FontWeight = 700
Case "SelCD"
Me.SelCD.FontSize = 14
Me.SelCD.FontWeight = 700
Case "SelCD2pl"
Me.SelCD2pl.FontSize = 14
Me.SelCD2pl.FontWeight = 700
Case "SelDVD"
Me.SelDVD.FontSize = 14
Me.SelDVD.FontWeight = 700
Case "SelRR7"
Me.SelRR7.FontSize = 14
Me.SelRR7.FontWeight = 700
Case "SelRR10"
Me.SelRR10.FontSize = 14
Me.SelRR10.FontWeight = 700
Case "SelVy10"
Me.SelVy10.FontSize = 14
Me.SelVy10.FontWeight = 700
Case "SelVy12"
Me.SelVy12.FontSize = 14
Me.SelVy12.FontWeight = 700
End Select
Select Case CurMedia 'Set previously selected media to its nominal display
properties.
Case "SelCA"
Me.SelCAS.FontSize = 11
Me.SelCAS.FontWeight = 400
Case "SelCD"
Me.SelCD.FontSize = 11
Me.SelCD.FontWeight = 400
Case "SelCD2pl"
Me.SelCD2pl.FontSize = 11
Me.SelCD2pl.FontWeight = 400
Case "SelDVD"
Me.SelDVD.FontSize = 11
Me.SelDVD.FontWeight = 400
Case "SelRR7"
Me.SelRR7.FontSize = 11
Me.SelRR7.FontWeight = 400
Case "SelRR10"
Me.SelRR10.FontSize = 11
Me.SelRR10.FontWeight = 400
Case "SelVy10"
Me.SelVy10.FontSize = 11
Me.SelVy10.FontWeight = 400
Case "SelVy12"
Me.SelVy12.FontSize = 11
Me.SelVy12.FontWeight = 400
End Select
CurMedia = SelMedia
End Function