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
Printable View
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
When your combobox is a DROPDOWN then you can use the solution at :
http://www.codeguru.com/combobox/col...ed_combo.shtml
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;
}
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
Thanks but I thought of that...it's a DropList