CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Listbox with Checkbox

    I'm writing an network application wich check wether a user is connected to the server or not. The users to check are kept in a listbox. I'm using a listbox with style set to checkboxed. When a user is online, the box is beeing checked, when he's offline, the box is unchecked. This is the part that working, now I want, when a the user doubbleclicks a listitem, anotherwindow pops up to send that user a message. The problem is not the window popping up, but the checkbox in the list beeing checked/unchecked. Is there a way to allow the user to dblclick the list, but not change the checkbox value?
    Thanx

    Tom Cannaerts
    [email protected]

    The best way to escape a problem, is to solve it.
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  2. #2
    Join Date
    May 1999
    Posts
    3,332

    Re: Listbox with Checkbox

    sorry to "bother" you again with my listView suggestions :-)
    You could do that using a listview instead of a listbox.
    Set the "checkbox" property to true,
    set listview to report mode

    Now you can check the checkbox or double-click the text without side-effects.


  3. #3
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Listbox with Checkbox

    When ever Lothar expresses his views about listView, i am there to say something about listbox!, well the old fahioned that i am :-)

    You can use the ItemData property of each item to store the actual state. and when user double clicks it you can re check/uncheck it back, depending on the ItemData. This item data will be populated by the logic which actually verifies if the user is connected to server or not. It ofcourse requires a little code, ( and be warned that checking the items thru code invokes another _click event, so you should put static/module level flags to block recursive processing )


    RK

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