|
-
June 23rd, 1999, 07:51 AM
#1
ComboBox
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
-
June 23rd, 1999, 08:00 AM
#2
Re: ComboBox
When your combobox is a DROPDOWN then you can use the solution at :
http://www.codeguru.com/combobox/col...ed_combo.shtml
-
June 23rd, 1999, 08:01 AM
#3
Re: ComboBox
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;
}
-
June 23rd, 1999, 08:07 AM
#4
Re: ComboBox
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
-
June 23rd, 1999, 08:07 AM
#5
Re: ComboBox
Thanks but I thought of that...it's a DropList
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|