Checkboxes and Shadowing, Unshadowing, Highlighting

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zufie

    Checkboxes and Shadowing, Unshadowing, Highlighting

    I have a main form containing 2 checkboxes.

    The respective checkboxes when checked cause the SepcialEffect
    Property to make all the textboxes to appear Shadowed.

    1)Although the Textboxes and Combo Boxes required to appear Shadowed
    are almost the same regardless of the checkbox that is checked how do
    I cause individual textboxes to appear Flat?

    2)How do I cause the Textboxes and Combo Boxes to highlight upon
    checking the respective checkbox?

    Here is my code:

    Private Sub ChckIBCCP_Click ()
    Dim ctl As Control


    For Each ctl In Me.Controls
    If ctl.Tag = "Shadow1" And ChckIBCCP = True _
    And ctl.ControlType = 109 Then
    ctl.SpecialEffe ct = 4
    ElseIf ctl.Tag <"Shadow1" And ctl.ControlType _
    = acTextBox Then
    ctl.SpecialEffe ct = 1
    End If
    Next
    End Sub

    Private Sub ChckOtherReferr al_Click()
    Dim ctl As Control


    For Each ctl In Me.Controls
    If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
    And ctl.ControlType = 109 Then
    ctl.SpecialEffe ct = 4
    ElseIf ctl.Tag <"Shadow1" And ctl.ControlType _
    = acTextBox Then
    ctl.SpecialEffe ct = 1
    End If
    Next


    End Sub

    Thanks,
    John
  • Salad

    #2
    Re: Checkboxes and Shadowing, Unshadowing, Highlighting

    zufie wrote:
    I have a main form containing 2 checkboxes.
    >
    The respective checkboxes when checked cause the SepcialEffect
    Property to make all the textboxes to appear Shadowed.
    >
    1)Although the Textboxes and Combo Boxes required to appear Shadowed
    are almost the same regardless of the checkbox that is checked how do
    I cause individual textboxes to appear Flat?
    >
    2)How do I cause the Textboxes and Combo Boxes to highlight upon
    checking the respective checkbox?
    >
    Here is my code:
    >
    Private Sub ChckIBCCP_Click ()
    Dim ctl As Control
    >
    >
    For Each ctl In Me.Controls
    If ctl.Tag = "Shadow1" And ChckIBCCP = True _
    And ctl.ControlType = 109 Then
    ctl.SpecialEffe ct = 4
    ElseIf ctl.Tag <"Shadow1" And ctl.ControlType _
    = acTextBox Then
    ctl.SpecialEffe ct = 1
    End If
    Next
    End Sub
    >
    Private Sub ChckOtherReferr al_Click()
    Dim ctl As Control
    >
    >
    For Each ctl In Me.Controls
    If ctl.Tag = "Shadow1" And ChckOtherReferr al = True _
    And ctl.ControlType = 109 Then
    ctl.SpecialEffe ct = 4
    ElseIf ctl.Tag <"Shadow1" And ctl.ControlType _
    = acTextBox Then
    ctl.SpecialEffe ct = 1
    End If
    Next
    >
    >
    End Sub
    >
    Thanks,
    John
    Realize if a textbox the ControlType value is 109. AcTextBox is also
    109. So you are excluding everything but textboxes.

    OK...first I'd create an Option Group. Find that control on the
    toolbox. Create 2 checkboxes for that option group. ChckIBCCP = 1,
    ChckOtherReferr al = 2

    With an option group it's going to either be one of the checkboxes or
    the other. You can combine your two subs into one sub.

    Now, put in the word Shadow1 for the tag property of all those controls
    you want affected with ChckIBCCP. Leave all others blank.

    Private Sub FrameSelection_ Click()

    Dim ctl As Control 'for looping.

    For Each ctl In Me.Controls
    If ctl.ControlType = acTextBox Or _
    ctl.ControlType = acComboBox Then
    'its a text box or combo box.

    If Me.FrameSelecti on = 1 Then
    'ChckIBCCP selected
    ctl.SpecialEffe ct = IIf(ctl.Tag = "Shadow1", 4, 1)
    Else
    ctl.SpecialEffe ct = IIf(ctl.Tag <"Shadow1", 4, 1)
    End If
    End If
    Next

    End Sub

    For the FrameSelection, I set the default to the ChckIBCCP value (or 1).
    I can then call the next sub in the OnOpen or OnCurrent event if needed.
    Private Form_Current()
    FrameSelection_ Click
    End Sub

    Golosa

    Comment

    Working...