tap-and-hold over a list

  • Thread starter Thread starter Dean Grimm
  • Start date Start date
D

Dean Grimm

Hi,
I'm sure I'm missing something totally obvious, but I
can't quite figure out how to get tap-and-hold
coordinates. I have added a context menu to a list box,
and need to know where the tap-and-hold occurred so I can
then do a hit test to figure out which list item the tap
occurred over. My problem is that it doesn't appear that
mousedown events are fired if it's a tap-and-hold. And the
ContextMenu.Popup event doesn't give you coordinates like
the mosedown event does. Any ideas how to detect where the
tap-and-hold occurred?

Thanks a bunch,
Dean
 
Dean,

Wouldn't the SelectedItem of the listbox give you the information you need?
(The CE 4.1 device I work with doesn't support tap-and-hold so I can't test
it at the moment.)
 
Hi Ginny,
No, unfortunately if it's a tap-and-hold operation, none
of the normal mouse event chain occurs, and therefore the
list item doesn't get selected. Sure would be nice if the
Popup event handler gave you the mouse coords, but alas,
it does not.
Dean
 
Popup event handler does not prevent you from getting mouse coords via
Control.MousePosition. Or, if you prefer, you can P/Invoke
[DllImport("coredll")]
extern static bool GetCursorPos(out Point pt);

The point will be in screen coordinates so you will need to use
ListBox.PointToClient() to convert it to the listbox client coordinates
 
Back
Top