From: Woody on
I am trying to disable ("gray out") some combo boxes, which are
"simple" (list box always shows, edit control). When I use
EnableWindow(FALSE), only the edit part of the combo is grayed. How
can I also have the list box drawn in the disabled color?
From: John H. on
Woody wrote:
> I am trying to disable ("gray out") some combo boxes, which are
> "simple" (list box always shows, edit control). When I use
> EnableWindow(FALSE), only the edit part of the combo is grayed. How
> can I also have the list box drawn in the disabled color?

Do you mean just the text of the items in list box, or also the
background?
For the former, EnableWindow(FALSE) should be sufficient. For the
latter, you might be able to get done with an override of OnCtlColor.
From: Joseph M. Newcomer on
I'd do it owner-draw. I'd ask in the DrawItem code if the control was enabled and if so,
draw the item with gray text.
joe

On Wed, 5 May 2010 19:32:45 -0700 (PDT), Woody <ols6000(a)sbcglobal.net> wrote:

>I am trying to disable ("gray out") some combo boxes, which are
>"simple" (list box always shows, edit control). When I use
>EnableWindow(FALSE), only the edit part of the combo is grayed. How
>can I also have the list box drawn in the disabled color?
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Woody on
What I am trying to do is show the user that the combo is not
available. In fact, there is no text in the list, and never will be as
long as the combo isn't available. This is already owner-draw fixed.
When I disable the combo, you get the strange appearance of an empty,
grayed edit control, and below it a white list box. Although it
functions properly, it looks dumb.

I suppose I could draw the entire list box, by putting a dummy item
consisting of spaces, and then using OnDraw to fill with the disabled
color, but this seems kind of kludgy. Then again, these are combo
boxes, right up there with the rich edit control.
From: Joseph M. Newcomer on
Set the OnEraseBkgnd handler to set the background to gray. There's a trick to painting
the unused parts of a simple combo box, but it has been too many years since I tried this
and I don't even recall what program I did it in. It would have been easier if there had
been text. There's an API that gets the listbox component of a combo box, and I'd
probably use that today (there was a horrible hack we had to do Back In The Day)
joe

On Thu, 6 May 2010 16:58:59 -0700 (PDT), Woody <ols6000(a)sbcglobal.net> wrote:

>What I am trying to do is show the user that the combo is not
>available. In fact, there is no text in the list, and never will be as
>long as the combo isn't available. This is already owner-draw fixed.
>When I disable the combo, you get the strange appearance of an empty,
>grayed edit control, and below it a white list box. Although it
>functions properly, it looks dumb.
>
>I suppose I could draw the entire list box, by putting a dummy item
>consisting of spaces, and then using OnDraw to fill with the disabled
>color, but this seems kind of kludgy. Then again, these are combo
>boxes, right up there with the rich edit control.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm