Thread: DoubleClick Area Validation in CListView :: MFC

  1. #1
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348

    DoubleClick Area Validation in CListView :: MFC

    Hello.

    In one of my programs, I created view derived from CListView. Everything works great. I implemented a double click feature where if the user double clicks an item, the program instantiates a dialog box, allowing the user the edit the text belonging to that item.

    I used the exact code Jeff Prosise presents in his book. There is one thing I would like to change. Current, the user has to click exact a spot inside the text belong to each item of the CListView. For example:

    ---------------
    item 1
    ---------------
    item 2
    ---------------
    item 3
    ---------------

    In the above sample, the user would have to click *on* one of the item text to be considered a valid double click. I would like to have it such that the user only needs to click a point inside the *item box*. So for example, the user can click any point as long as it is inside a specific *item box*.

    Prosise uses this funtion to validate the point.

    // GetListCtrl()->HitTest(point);

    I believe HitTest(...) check a specific text, not the item box in general. Is there a way to check using a broader item box area instead of specific item text?

    Thanks,
    Kuphryn

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    8
    You could try puting a CRect around the box and use;

    CRect area(0,0,10,10) // where the coordinates are around
    the area you want the mouse to be clicked in

    area.PtInRect(pos)// where pos is the point of the mouse click

    put that in an if statement and run the method from there

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Thanks.

    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MFC: Clear Client Area
    By mrafcho001 in forum Windows Programming
    Replies: 2
    Last Post: 06-27-2005, 01:35 PM
  2. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  4. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM
  5. CListView & Appending Items :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 04-28-2002, 11:37 AM