martini
July 14th, 1999, 07:13 AM
How do I use the CCheckListBox control. Please let me know step by step.
|
Click to See Complete Forum and Search --> : CCheckListBox martini July 14th, 1999, 07:13 AM How do I use the CCheckListBox control. Please let me know step by step. Martin Speiser July 14th, 1999, 07:37 AM Hi Martini, the first step is similar to a normal CListBox, you add one to a dialog in RessourceView. Then you add a member variable of type control to your dialog. Third, open the dialog's header file and look for the definition of this variable. Should be something like CListBox m_ctlMyListBox; And the last step is to change the word "CListBox" to "CCheckListBox". That's all. After that you can use the additional members of the CCheckListBox class in your code. With changing the type of the member control variable you use the subclassing feature of MFC. Nice, isn't it? ;-) HTH Martin martini July 14th, 1999, 08:34 AM dosen't seem to work!!! Rail Jon Rogut July 14th, 1999, 03:05 PM In the Resource Editor, set the style of the ListBox to Owner Draw and Fixed. Rail Recording Engineer/Software Developer Rail Jon Rogut Software railro@earthlink.net http://home.earthlink.net/~railro/ martini July 14th, 1999, 11:30 PM seems to give me assertion failure when I click on it. I guess i'm doing something wrong!! Rail Jon Rogut July 14th, 1999, 11:42 PM My fault... You also have to check the Has Strings style. From the MFC source code: int CCheckListBox::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CListBox::OnCreate(lpCreateStruct) == -1) return -1; if ((GetStyle() & (LBS_OWNERDRAWFIXED | LBS_HASSTRINGS)) == (LBS_OWNERDRAWFIXED | LBS_HASSTRINGS)) SetItemHeight(0, CalcMinimumItemHeight()); return 0; } Sorry... that should fix it.. if it doesn't le'me know. Rail Recording Engineer/Software Developer Rail Jon Rogut Software railro@earthlink.net http://home.earthlink.net/~railro/ codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |