double click in treeview launching dialog box eats mouse input - Programmer

This is a discussion on double click in treeview launching dialog box eats mouse input - Programmer ; This one has me completely flummoxed. I have a tree view derived class in which I handle double clicks (NM_DBLCLK or WM_LBUTTONDBLCLK, doesn't matter which). I am supposed to launch a (modal) dialog box which works fine. However, if I ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: double click in treeview launching dialog box eats mouse input

  1. double click in treeview launching dialog box eats mouse input

    This one has me completely flummoxed.

    I have a tree view derived class in which I handle double clicks
    (NM_DBLCLK or WM_LBUTTONDBLCLK, doesn't matter which). I am supposed
    to launch a (modal) dialog box which works fine.

    However, if I left or right click *anywhere* on the entire screen
    (including the launched dialog box itself) that click goes to the tree
    view! Just the first click. All subsequent clicks go to the dialog box
    as they should.

    The dialog _is_ the topmost and active window; why does the first
    click go to the tree view?

    If I launch the same dialog from anywhere else it works fine. Also,
    launching a message box instead of the dialog from the tree view seems
    to work ok too.

    Thanks in advance for any help.

    Sandeep

  2. Re: double click in treeview launching dialog box eats mouse input

    >I have a tree view derived class in which I handle double clicks
    >(NM_DBLCLK or WM_LBUTTONDBLCLK, doesn't matter which). I am supposed
    >to launch a (modal) dialog box which works fine.
    >
    >However, if I left or right click *anywhere* on the entire screen
    >(including the launched dialog box itself) that click goes to the tree
    >view! Just the first click. All subsequent clicks go to the dialog box
    >as they should.


    Sandeep,

    Try delaying when you invoke the modal dialog box.

    Rather than do it in the double click handler, post a user defined
    message to the same window from the double click handler, and display
    the dialog in response to receiving that user defined message.

    Dave
    --
    MVP VC++ FAQ: http://www.mvps.org/vcfaq

  3. Re: double click in treeview launching dialog box eats mouse input

    David Lowndes wrote in message news:...
    > Try delaying when you invoke the modal dialog box.
    >
    > Rather than do it in the double click handler, post a user defined
    > message to the same window from the double click handler, and display
    > the dialog in response to receiving that user defined message.


    Nope... that didn't do it (and yes, I used PostMessage() not
    SendMessage()). What you said sort of makes sense though.

    I do have a "workaround" : send a WM_LBUTTONDOWN/WM_LBUTTONUP before
    launching the dialog which works but has other problems. The dialog
    won't launch unless I _move_ the cursor.

    Scary huh?

    Sandeep

  4. Re: double click in treeview launching dialog box eats mouse input

    >Nope... that didn't do it (and yes, I used PostMessage() not
    >SendMessage()). What you said sort of makes sense though.


    Hmm, are you passing the double click notification on to the default
    handler?

    Dave
    --
    MVP VC++ FAQ: http://www.mvps.org/vcfaq

  5. Re: double click in treeview launching dialog box eats mouse input

    bogusami@hotmail.com (Sandeep Pulla) wrote in message news:...
    > I do have a "workaround" : send a WM_LBUTTONDOWN/WM_LBUTTONUP before
    > launching the dialog which works but has other problems. The dialog
    > won't launch unless I _move_ the cursor.


    OK. I have fixed this problem I believe.

    // inside NM_DBLCLK handler
    PostMessage(WM_LBUTTONDOWN, ...); // instead of SendMessage()
    PostMessage(WM_LBUTTONUP, ...);
    // launch dialog here

    This works, don't ask me why.

    Sandeep

  6. Re: double click in treeview launching dialog box eats mouse input

    Dave,

    David Lowndes wrote in message news:...
    > Hmm, are you passing the double click notification on to the default
    > handler?


    When I add a handler for NM_DBLCLK, it is an ON_NOTIFY_REFLECT handler
    and there is no default (base class) handler. You do have a parameter
    LRESULT* pResult which is typically set to zero/non-zero to indicate
    whether or not the parent should handle the message -- I've tried both
    without any apparant difference.

    Thanks,
    Sandeep

+ Reply to Thread