- Create a read-only combo box that can be easily changed to accept input
which isn't too light?
OR
- Reset the appearance on a combo box that has been disabled so the text is
more readable?
Thanks in advance
Clyde
Or use GetDlgItem to get a pointer to the Combobox and then use the
functions.
Hope this helps Guido
Clyde Gerber wrote in message ...
Jean Cai wrote in message ...
>The "Drop List" type of ComboBox is read only.
However, the "Drop List" ComboBox doesn't display the initial value of the
control -- I'd like to display data from a database query, then allow the
user to enable the control by pressing another button and selecting from the
combobox.
Guido Ramseier wrote in message <3557E0...@rhein-main.netsurf.de>...
>If you are using MFC you could use the Class Wizard to make an obect of
>type CCombobox and use the Enable(FALSE) Enable(TRUE) functions of CWnd.
>
>Or use GetDlgItem to get a pointer to the Combobox and then use the
>functions.
This is exactly what I intended to do, however the displayed text is very
light and hard to read. (It's much light than a read-only CEdit control,
for example.) Is there a simple way to make the font in the control bolder
or darker when the control is disabled?
>This is exactly what I intended to do, however the displayed text is very
>light and hard to read. (It's much light than a read-only CEdit control,
>for example.) Is there a simple way to make the font in the control bolder
>or darker when the control is disabled?
>
One possibility is to code a handler for the CBN_SETFOCUS message for
the combobox. In the handler, you can either show a message that it is
not allowed to modify that entry at that point, or, you can simply
shift the focus to another control. This way, you don't have to
disable the combobox.
Here's a sample:
HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
// TODO: Change any attributes of the DC here
switch (nCtlColor)
case CTLCOLOR_EDIT:
case CTLCOLOR_MSGBOX:
case CTLCOLOR_LISTBOX:
// Set color to dark blue on light blue and return the background
brush.
pDC->SetTextColor(RGB(0, 0, 128));
pDC->SetBkColor(RGB(0, 200, 255));
return (HBRUSH)(m_pComboBkBrush->GetSafeHandle());
default:
return CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
}
Murali Krishna Devarakonda
Clyde Gerber wrote in message ...
<<<snip>>>
>light (much lighter than a read-only CEdit). Does anyone know of a way to:
>
>- Create a read-only combo box that can be easily changed to accept input
>which isn't too light?
>OR
>- Reset the appearance on a combo box that has been disabled so the text
is
>more readable?
<<<snip>>>