Click to See Complete Forum and Search --> : ComboBox
sbrandwood
June 23rd, 1999, 07:51 AM
Hi
I'd like to set my combo to read only like you can with a CEdit ie: SetReadOnly, so far I've just used EnableWindow(false), but the text is the grey. What should I do?
Many Thanks
Franky Braem
June 23rd, 1999, 08:00 AM
When your combobox is a DROPDOWN then you can use the solution at :
http://www.codeguru.com/combobox/color_in_disabled_combo.shtml
olivier
June 23rd, 1999, 08:01 AM
put the WM_CTLCOLOR and do something like
COptionCalcApp::s_ReadOnlyBrush; is a Static Brush of my Application
CBrush COptionCalcApp::s_ReadOnlyBrush (RGB (255, 255, 255));
HBRUSH COptionView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
int iId = pWnd->GetDlgCtrlID ();
if (iId == IDC_MYCOMBOBOX)
{
//pDC->SetBkColor (RGB (0, 255, 255));
return COptionCalcApp::s_ReadOnlyBrush;
}
else
return hbr;
}
Fabi Pantera
June 23rd, 1999, 08:07 AM
Instead of the other guy adress, try this :
Make your own class CYourComboBox derived from CCOmboBox. Set a BOOL member whitch indicates you the read-only state. Override OnChar on this function. If the bool member is TRUE just return from OnChar (don't call the base class method).
Please let me know if this is realy make you happy!
Best regards,
Faby
sbrandwood
June 23rd, 1999, 08:07 AM
Thanks but I thought of that...it's a DropList
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.