Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mouseover Listbox - what is under the cursor?
Message
De
16/07/2004 09:25:42
 
 
À
15/07/2004 18:18:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00924946
Message ID:
00925130
Vues:
31
>I would like to know how to get the value, or at least the ItemId or
>ListItemId of the current item under the mouse in the listbox without
>clicking on it. Mind you, the list box could be scrolled to the
>middle of the list, but whatever is under the mouse, that is what I
>want.
>
>Any thoughts?
>
>I know that I can use the MouseMove event to get the coords, but how,
>if at all, do I determine what list item the mouse is over?
>
>David


Hi David,

Try this:
*** Listbox MouseMove events
Local lc_FontStyle, ln_FontHeight, ln_Index

With This
   lc_FontStyle = iif( .FontBold, 'B', '' ) + iif( .FontItalic, 'I', '' ) + ;
      iif( .FontUnderline, 'U', '' )
   ln_FontHeight = FontMetric( 1, .FontName, .FontSize, lc_FontStyle ) + ;
      FontMetric( 4, .FontName, .FontSize, lc_FontStyle )

   ln_Index = .TopIndex + int((nYCoord - .Top) / ln_FontHeight)
   * .ListIndex = ln_Index   && autoselect
   Wait .List( ln_Index ) window nowait
EndWith
HTH
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform