locked
CLIstView

    Pregunta

  • Hi,

    i am using CListview class, and  i need to use 

    OnNMDblclk(NMHDR *pNMHDR, LRESULT *pResult)   this  function give me information of the item 

    OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) this function must edit the sub-item list 

    i supposed i must use OnLButtonDown  but i always get the  OnNMClick and give mi the edit sub-item 

    Is there any method to differentiate whether the User has clicked once or twice.

    thanks for help 


    Gio

    jueves, 12 de abril de 2012 15:25

Respuestas

  • but I still have a question, how clistview handles the click and dbclick?


    You can see this for yourself by clicking in the right pane of Windows Explorer.  Click selects a file, double click opens the file. This is in accord with the Windows user interface guidelines.

    What you propose to do is the exact opposite and will annoy users. You should not perform a modal action (like open for edit) on a click if the same target also is expected to do something else on double-click.   You should consider reversing your planned user interface design.

     

    viernes, 13 de abril de 2012 0:35

Todas las respuestas

  • In order to differentiate a simple click from a click that maybe will be followed quickly by second click, you can try the following approach. When you receive a click (OnNMClick), create a timer using SetTimer having a timeout obtained by GetDoubleClickTime plus few milliseconds. When the interval expires (OnTimer), stop the timer with KillTimer and start your editing flow, since this is a simple click. But if you receive double click (OnNMDblClk), then stop the timer and show information about the item.

    By the way, if you use LVS_EDITLABEL style, then the System will help you more by sending LVN_BEGINLABELEDIT notification.




    • Editado Viorel_MVP jueves, 12 de abril de 2012 18:42
    jueves, 12 de abril de 2012 18:33
  • thanks for your answer, you gave me a good idea, i will try it,
    but I still have a question, how clistview handles the click and dbclick?


    Gio

    jueves, 12 de abril de 2012 20:35
  • but I still have a question, how clistview handles the click and dbclick?


    You can see this for yourself by clicking in the right pane of Windows Explorer.  Click selects a file, double click opens the file. This is in accord with the Windows user interface guidelines.

    What you propose to do is the exact opposite and will annoy users. You should not perform a modal action (like open for edit) on a click if the same target also is expected to do something else on double-click.   You should consider reversing your planned user interface design.

     

    viernes, 13 de abril de 2012 0:35