Listbox Click

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.

Parents
  • Verified Answer

    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.
          
    
Reply
  • Verified Answer

    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.
          
    
Children
No Data