View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Determine closest control to MouseUp event?

Is there an easy, accurate method to determine the closest control to
a MouseUp (or MouseDown, if it's easier) event, if the user clicks
on the UserForm instead of a control? (My form will be used on a
touch screen.)

My current best guess is to do it manually (so to speak): look at the
coordinates of the click, and then look at the coordinates of each
control and decide which one is closest. I'm sure it'll work, but
it's going to be a PITA, and I'm looking for something built-in, or
alternately code that's already been written. (My google-fu has
failed me here.)


Mouse clicks will be measured/scaled in screen position. Controls on a
userform are positioned from 0,0 (top,left) of the form. You'll need to
do some conversion and control mapping to do this. Wouldn't it be
easier/better, though, for the user to just click the desired control?
Or use the Tab key to move around the controls in the order you've
defined?

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion