CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Sep 2003
    Posts
    815

    list box - check box

    Hi,

    I was wondering if there is, something like a dynamic list of checkboxs, is it something that is implemented threw list box?

    or in other words I need to implement a dialog with a variable number of checkboxs....

    any idea?

    thanks
    avi
    Last edited by avi123; February 5th, 2004 at 08:39 AM.

  2. #2
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83
    Try CCheckListBox (in MFC).

  3. #3
    Join Date
    Sep 2003
    Posts
    815
    is it in the toolbox?

    can you pls be more specific?

    thanks

  4. #4
    Join Date
    May 2002
    Location
    India
    Posts
    268

    Try List view

    Hi mate,
    You can use a list control (list view) in the list mode and use the extended style LVS_EX_CHECKBOXES to get the same.
    Life is short, enjoy it with a smile as long as it lasts.
    User error. Replace User and press any key when ready. - Anonymous

  5. #5
    Join Date
    Apr 2003
    Location
    UK
    Posts
    83
    Look it up in MSDN. Here, I've done it for you

    There's a link to a sample program.

  6. #6
    Join Date
    Feb 2002
    Posts
    3,788
    no, it's not in the toolbox.
    you have to Create(...) yourself.
    however you can try the ListCtrl with the extended style LVS_EX_CHECKBOXES.

  7. #7
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635
    Originally posted by avi123
    is it in the toolbox?

    can you pls be more specific?

    thanks
    Use the resource edit to create a regular listbox. Then use ClassWizard to declare a control member variable using it. Change the control type from CListBox to CCheckListBox. There are a few styles you have to change in the resource editor, but off the top of my head I don't remember what they are. Owner Draw is one of them I think.

  8. #8
    Join Date
    Sep 2003
    Posts
    815
    Originally posted by GCDEF
    Use the resource edit to create a regular listbox. Then use ClassWizard to declare a control member variable using it. Change the control type from CListBox to CCheckListBox. There are a few styles you have to change in the resource editor, but off the top of my head I don't remember what they are. Owner Draw is one of them I think.
    shouldn't I use my own class deriving from CCheckListBox?
    Do I have to deive my own class when using list control (and not list box)?

    thanks again to all of you
    avi

  9. #9
    Join Date
    Feb 2002
    Posts
    3,788
    shouldn't I use my own class deriving from CCheckListBox?
    not necessarily.

    Do I have to deive my own class when using list control (and not list box)?
    No, this control it's in the toolbox.

  10. #10
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635
    Originally posted by avi123
    shouldn't I use my own class deriving from CCheckListBox?
    Do I have to deive my own class when using list control (and not list box)?

    thanks again to all of you
    avi
    No need to derive your onw class unless you need some kind of functionality not provided by CCheckListBox or CListCtrl with the check style set.

  11. #11
    Join Date
    Sep 2003
    Posts
    815
    so how do I add CCheckListBox, how do I determine how many check boxes will be?

    thanks again
    avi

  12. #12
    Join Date
    Sep 2003
    Posts
    815
    Hi again,

    I understnad from the answers that there is no need to inherit the class unless I need some specail functoialty

    I decided to use list control (list view) and I want my checkboxes to be disabled, is this a special functality? cause I didn't find how do to that....

    another thing, I only I want a few checkboxs in one line of the list, is this possible?

    thanks again
    avi
    Last edited by avi123; February 8th, 2004 at 10:16 AM.

  13. #13
    Join Date
    Sep 2003
    Posts
    815
    Originally posted by myth7676
    no, it's not in the toolbox.
    you have to Create(...) yourself.
    however you can try the ListCtrl with the extended style LVS_EX_CHECKBOXES.
    what view (report/icon...) do I have to use in ListCtrl so I can add this LVS_EX_CHECKBOXES

    thanks
    avi

  14. #14
    Join Date
    Feb 2002
    Posts
    3,788
    Originally posted by avi123
    what view (report/icon...) do I have to use in ListCtrl so I can add this LVS_EX_CHECKBOXES

    thanks
    avi
    you can use the "Report" view

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured