Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2007
    Posts
    25

    Unanswered: Backcolor of a control not enabled.

    I have a control that the back color when Enabled = False is always gray. I'd rather the back color to be a specific color, but it always looks gray when its not enabled even though I told it a different back color.

    Is there a way to have a custom backcolor on a control that is not enabled?

    Thanks,

    RJ

  2. #2
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Yes. Lock it too (Locked: Yes).
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  3. #3
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by StarTrekker
    Yes. Lock it too (Locked: Yes).
    I've tried with locked, I've tried with disabled. As long as it's disabled its gray. I'd like it to be a different color besides gray. Is that possible?

  4. #4
    Join Date
    Dec 2006
    Location
    Momence, IL USA
    Posts
    56
    You never said what the control is. But if it is always gray when disabled, you might just leave it enabled, use a boolean value (like disabled = true), and in the event that does real work, do nothing. For instance, for a button:

    Sub ThisButton_Click()
    If Not disabled then
    DoMyThing
    End If
    End Sub

    And in the code that determines the disabled state, you can change the backcolor and put the control in and out of the forms tab order.
    Don't Bogart That Squishee!

  5. #5
    Join Date
    Dec 2007
    Posts
    25
    Quote Originally Posted by a-dam
    You never said what the control is. But if it is always gray when disabled, you might just leave it enabled, use a boolean value (like disabled = true), and in the event that does real work, do nothing. For instance, for a button:

    Sub ThisButton_Click()
    If Not disabled then
    DoMyThing
    End If
    End Sub

    And in the code that determines the disabled state, you can change the backcolor and put the control in and out of the forms tab order.
    It's actually for an OLEObject. The user needs to never interact with it as it is set by another form. Just appears on this form. It should be disabled and locked in theory on this form, but needs to be variable in size. I figured if I just set a background to pure white and this object is always a pure white background, then if the object they select is smaller than the size in the form, you would only see white. The problem is that when I disable the object so it can't accidently be clicked or tabbed to, the background goes gray when the object doesn't take up the entire area.

    Are you saying there is no way to set the background color of a disabled control?

  6. #6
    Join Date
    Nov 2007
    Location
    Adelaide, South Australia
    Posts
    4,049
    Quote Originally Posted by rjwebgraphix
    I've tried with locked, I've tried with disabled. As long as it's disabled its gray. I'd like it to be a different color besides gray. Is that possible?
    Did you try Locked: Yes AND Enabled: No ?

    I tested with a couple of OLE objects and the behaviour is still the same:

    - Enabled: No alone makes it go greyed out and the object cannot be interacted with.
    - Locked: Yes alone makes the object unchangeable, but you can still interact with it.
    - Locked: Yes and Enabled: No, makes the object retain colours but the object cannot be interacted with.
    Owner and Manager of
    CypherBYTE, Microsoft Access Development Specialists.
    Microsoft Access MCP.
    And all around nice guy!


    "Heck it's something understood by accountants ... so it can't be 'that' difficult..." -- Healdem
    "...teach a man to code and he'll be frustrated for life! " -- georgev

  7. #7
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    if you want to change its colour so it merges with the background then have you considered changing the controls visibility rather than whether its enabled... if its not visible then the colour issue should go away.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •