Re: CComboBox/CListBox
From: Trevor (trevor_at_spam.com)
Date: 08/12/04
- Next message: Arnaud Debaene: "Re: Windows messages for communication"
- Previous message: Trevor: "Re: Windows File Caching"
- In reply to: Jase Onederczild: "CComboBox/CListBox"
- Next in thread: Joseph M. Newcomer: "Re: CComboBox/CListBox"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 16:57:44 -0400
Jase Onederczild wrote:
> Hello
>
> I have a CComboBox who's type is Drop List (ie. the text is static). When
> the down arrow button is of the CComboBox I believe that a CListBox is the
> result. What I would like to do is to be able to disable items in that
> CListBox so that they can't be selected. I noticed that there's a list box
> style LBS_NOSEL that indicates that a the list box can have items that can
> only be viewed but not selected, but I have no idea how to set specific items
> so that that they can only be viewed and not selected. I noticed that you
> can get pointer to a data item, except the pointer in all likelyhood is void
> and I'm not quite sure if the CListBox would be able to interpret anything
> saved in this pointer so that it could enable/disable the item.
>
> Thanks,
>
> J
Forget about LBS_NOSEL. You need to hook into CBN_SELENDOK. Here is
some code:
void CADlg::OnSelendokCombo1()
{
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
if (pCombo->GetCurSel() != -1) // If any item is about to be selected...
pCombo->SetCurSel(-1); // Set the selection to nothing
}
- Next message: Arnaud Debaene: "Re: Windows messages for communication"
- Previous message: Trevor: "Re: Windows File Caching"
- In reply to: Jase Onederczild: "CComboBox/CListBox"
- Next in thread: Joseph M. Newcomer: "Re: CComboBox/CListBox"
- Messages sorted by: [ date ] [ thread ]