Example of CCheckListBox
Glenn T. Jayaputera -- gtj@nunkeen.apana.org.au
Monday, April 08, 1996
Env: MFC4.0 + Win95/NT
I am looking for some example on how to use CCheckListBox.
Anybody has it??
tia
glenn tesla
LeRoy Baxter -- lbaxter@cinfo.com
Wednesday, April 10, 1996
use it just like a regular CListBox except:
1. you have to subclass in your OnInitDialog()
ie. add a CheckListBox to your Dialog using the Resource Editor
add a member variable to your Dialogs header file like: CCheckListBox m_lbItems;
then subclass: m_lbItems.SubclassDlgItem(IDC_ITEMS, this);
2. after that, you have GetCheck() and SetCheck()
ie. m_lbItems.SetCheck(idx, 1); and: int state = m_lbItems.GetCheck(idx);
----------
From: Glenn T. Jayaputera[SMTP:gtj@nunkeen.apana.org.au]
Sent: Monday, April 08, 1996 5:15 AM
To: mfc-l@netcom.com
Subject: Example of CCheckListBox
Env: MFC4.0 + Win95/NT
I am looking for some example on how to use CCheckListBox.
Anybody has it??
tia
glenn tesla
Roland Pasternack -- rpasternack@MSERVER2.Legato.COM
Monday, April 15, 1996
If I may diverge slightly from the original question...
Answer number 1 below says to add a CheckListBox using the Resource Editor. I
wanted to do this recently, but it wasn't obvious how to do it. There is no
CheckListBox button in the floating dialog box within AppStudio, where you
choose controls to place within the dialog box you are building. If you pick
a check box, there is no style that gives you this. I searched all of the
online documentation and found nothing explaining how to do this. I assume it
is something obvious, but I have missed it. So the question is: how do you
use the Resource Editor to place a checklistbox into a dialog box you are
building?
______________________________ Reply Separator _________________________________
Subject: RE: Example of CCheckListBox
Author: mfc-l@netcom.com at LEGATO_SMTP
Date: 4/12/96 9:20 PM
use it just like a regular CListBox except:
1. you have to subclass in your OnInitDialog()
ie. add a CheckListBox to your Dialog using the Resource Editor
add a member variable to your Dialogs header file like:
CCheckListBox m_lbItems;
then subclass: m_lbItems.SubclassDlgItem(IDC_ITEMS, this);
2. after that, you have GetCheck() and SetCheck()
ie. m_lbItems.SetCheck(idx, 1); and: int state =
m_lbItems.GetCheck(idx);
----------
From: Glenn T. Jayaputera[SMTP:gtj@nunkeen.apana.org.au]
Sent: Monday, April 08, 1996 5:15 AM
To: mfc-l@netcom.com
Subject: Example of CCheckListBox
Env: MFC4.0 + Win95/NT
I am looking for some example on how to use CCheckListBox.
Anybody has it??
tia
glenn tesla
Mike Blaszczak -- mikeblas@msn.com
Wednesday, April 17, 1996
[Mini-digest: 2 responses]
----------
From: owner-mfc-l@netcom.com on behalf of Roland Pasternack
Sent: Monday, April 15, 1996 09:20
> So the question is: how do you
> use the Resource Editor to place a
> checklistbox into a dialog box you are building?
You don't. You simply draw a regular list box. A checked list box is an
owner-drawn list box that has check marks for each item. So, you should make
the list box resource you add owner-draw. Then, you should subclass the
control to be a CCheckListBox instead of a CListBox like someone in the thread
you forwarded suggested.
.B ekiM
TCHAR sz[] = _T("I don't speak for Microsoft.");
-----From: "LeRoy J. Baxter"
Sorry - it should be:
Add regular listbox to your dialog in the resource editor (as I recall, it must be owner-draw -
(mine are owner-draw fixed, Has Strings)
Add a CCheckListBox member variable to the dialogs' header file
then subclass in the InitDialog()
| Вернуться в корень Архива
|