Skip to main content

Are there any example of determining the difference between a click and a double click on a listbox?  Have searched and can not find much.

Are there any example of determining the difference between a click and a double click on a listbox?  Have searched and can not find much.

There are two different event handlers for a Click or DoubleClick events that you can check individually.

If you are trying to select an item when only the double-click is used then you can use something like the following using the MouseDoubleClick event:

       method-id listBox1_MouseDoubleClick final private.
       procedure division using by value sender as object e as type System.Windows.Forms.MouseEventArgs.
       
           declare i as binary-long = self::listBox1::IndexFromPoint(e::Location)
           if i not = type System.Windows.Forms.ListBox::NoMatches
              set textBox1::Text to Listbox1::SelectedItem
           end-if
               
       end method.
      

Are there any example of determining the difference between a click and a double click on a listbox?  Have searched and can not find much.

Thanks, that worked great!