Salut
Je dois creer un bouton qui incremente et decremente une valeur dans un
textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner) ne me
conviennent pas.
Tout fonctionne excepté que si on déplace le curseur a l'extérieur des zones
du bouton le textbox continue a s'incrémenté malgré tout.
Alors ma question, est que je voudrais vérifier si ma souris est toujours
sur le bouton lorsque j'incrémente
Merci
Voici un exemple
Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer, Shift As
Integer, x As Single, y As Single)
Dim t#
MouseDown = True
If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
End If
While MouseDown = True And Timer - t < 0.4 And Timer >= t
DoEvents
Wend
While MouseDown = True
If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
End If
t = Timer
Do While Timer - t < 0.04 And Timer >= t
DoEvents
Loop
Wend
'suite de mon code une fois le bouton relaché
End Sub
Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift As
Integer, x As Single, y As Single)
MouseDown = False
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
X
Bonjour,
Voix l'évènement:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' X et Y sont la position End Sub
-- Merci beaucoup, au revoir et à bientôt :o) ------ Site logiciels http://irolog.free.fr Mail http://irolog.free.fr/ecrire/index.htm Site perso http://irolog.free.fr/joe/index.htm Principe d'utilisation des news Groups http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm ------------------------------------------------------------------------------------ "Daniel" a écrit dans le message de news: %
Salut Je dois creer un bouton qui incremente et decremente une valeur dans un textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner) ne me conviennent pas.
Tout fonctionne excepté que si on déplace le curseur a l'extérieur des zones du bouton le textbox continue a s'incrémenté malgré tout.
Alors ma question, est que je voudrais vérifier si ma souris est toujours sur le bouton lorsque j'incrémente
Merci
Voici un exemple
Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) Dim t# MouseDown = True If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") End If While MouseDown = True And Timer - t < 0.4 And Timer >= t DoEvents Wend
While MouseDown = True If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") End If t = Timer Do While Timer - t < 0.04 And Timer >= t DoEvents Loop Wend
'suite de mon code une fois le bouton relaché End Sub
Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) MouseDown = False
End Sub
Bonjour,
Voix l'évènement:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As
Single)
' X et Y sont la position
End Sub
--
Merci beaucoup, au revoir et à bientôt :o)
------
Site logiciels
http://irolog.free.fr
Mail
http://irolog.free.fr/ecrire/index.htm
Site perso
http://irolog.free.fr/joe/index.htm
Principe d'utilisation des news Groups
http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm
------------------------------------------------------------------------------------
"Daniel" <no@junk.com> a écrit dans le message de news:
%23cWK4VWXGHA.4716@TK2MSFTNGP02.phx.gbl...
Salut
Je dois creer un bouton qui incremente et decremente une valeur dans un
textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner) ne
me
conviennent pas.
Tout fonctionne excepté que si on déplace le curseur a l'extérieur des
zones
du bouton le textbox continue a s'incrémenté malgré tout.
Alors ma question, est que je voudrais vérifier si ma souris est toujours
sur le bouton lorsque j'incrémente
Merci
Voici un exemple
Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer, Shift
As
Integer, x As Single, y As Single)
Dim t#
MouseDown = True
If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
End If
While MouseDown = True And Timer - t < 0.4 And Timer >= t
DoEvents
Wend
While MouseDown = True
If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
End If
t = Timer
Do While Timer - t < 0.04 And Timer >= t
DoEvents
Loop
Wend
'suite de mon code une fois le bouton relaché
End Sub
Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift As
Integer, x As Single, y As Single)
MouseDown = False
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' X et Y sont la position End Sub
-- Merci beaucoup, au revoir et à bientôt :o) ------ Site logiciels http://irolog.free.fr Mail http://irolog.free.fr/ecrire/index.htm Site perso http://irolog.free.fr/joe/index.htm Principe d'utilisation des news Groups http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm ------------------------------------------------------------------------------------ "Daniel" a écrit dans le message de news: %
Salut Je dois creer un bouton qui incremente et decremente une valeur dans un textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner) ne me conviennent pas.
Tout fonctionne excepté que si on déplace le curseur a l'extérieur des zones du bouton le textbox continue a s'incrémenté malgré tout.
Alors ma question, est que je voudrais vérifier si ma souris est toujours sur le bouton lorsque j'incrémente
Merci
Voici un exemple
Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) Dim t# MouseDown = True If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") End If While MouseDown = True And Timer - t < 0.4 And Timer >= t DoEvents Wend
While MouseDown = True If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") End If t = Timer Do While Timer - t < 0.04 And Timer >= t DoEvents Loop Wend
'suite de mon code une fois le bouton relaché End Sub
Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single) MouseDown = False
End Sub
Daniel
Merci mais ca fonctionne pas comme je le veux cet evenement j'ai finalement trouvé
j'ai utilisé 2 fonction API pour lire la position de la souris
public Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As PointAPI) As Long
Type PointAPI X As Long Y As Long End Type
While MouseDown = True Call GetCursorPos(MousePos) ScreenToClient BDownValue(Index).hwnd, MousePos If MousePos.X >= 0 And MousePos.X < BDownValue(Index).Width / 15 _ And MousePos.Y >= 0 And MousePos.Y < BDownValue(Index).Height / 15 Then If Val(Batcher(Index).Text) - 0.01 >= 0.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) - 0.01, "0.00") End If t = Timer While Timer - t < 0.04 And Timer >= t DoEvents Wend End If DoEvents Wend
"X" a écrit dans le message de news:
Bonjour,
Voix l'évènement:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' X et Y sont la position End Sub
-- Merci beaucoup, au revoir et à bientôt :o) ------ Site logiciels http://irolog.free.fr Mail http://irolog.free.fr/ecrire/index.htm Site perso http://irolog.free.fr/joe/index.htm Principe d'utilisation des news Groups http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm --------------------------------------------------------------------------
----------
"Daniel" a écrit dans le message de news: % > Salut > Je dois creer un bouton qui incremente et decremente une valeur dans un > textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner)
ne
> me > conviennent pas. > > Tout fonctionne excepté que si on déplace le curseur a l'extérieur des > zones > du bouton le textbox continue a s'incrémenté malgré tout. > > Alors ma question, est que je voudrais vérifier si ma souris est
toujours
> sur le bouton lorsque j'incrémente > > Merci > > Voici un exemple > > Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer,
Shift
> As > Integer, x As Single, y As Single) > Dim t# > MouseDown = True > If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then > Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") > End If > While MouseDown = True And Timer - t < 0.4 And Timer >= t > DoEvents > Wend > > While MouseDown = True > If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then > Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") > End If > t = Timer > Do While Timer - t < 0.04 And Timer >= t > DoEvents > Loop > Wend > > 'suite de mon code une fois le bouton relaché > End Sub > > Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift
As
> Integer, x As Single, y As Single) > MouseDown = False > > End Sub > >
Merci mais ca fonctionne pas comme je le veux cet evenement
j'ai finalement trouvé
j'ai utilisé 2 fonction API pour lire la position de la souris
public Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As
Long
Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long,
lpPoint As PointAPI) As Long
Type PointAPI
X As Long
Y As Long
End Type
While MouseDown = True
Call GetCursorPos(MousePos)
ScreenToClient BDownValue(Index).hwnd, MousePos
If MousePos.X >= 0 And MousePos.X < BDownValue(Index).Width / 15 _
And MousePos.Y >= 0 And MousePos.Y < BDownValue(Index).Height / 15 Then
If Val(Batcher(Index).Text) - 0.01 >= 0.5 Then
Batcher(Index).Text = Format(Val(Batcher(Index).Text) - 0.01, "0.00")
End If
t = Timer
While Timer - t < 0.04 And Timer >= t
DoEvents
Wend
End If
DoEvents
Wend
"X" <X@Y.Z> a écrit dans le message de news:
eKyIsDZXGHA.3760@TK2MSFTNGP02.phx.gbl...
Bonjour,
Voix l'évènement:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As
Single)
' X et Y sont la position
End Sub
--
Merci beaucoup, au revoir et à bientôt :o)
------
Site logiciels
http://irolog.free.fr
Mail
http://irolog.free.fr/ecrire/index.htm
Site perso
http://irolog.free.fr/joe/index.htm
Principe d'utilisation des news Groups
http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm
--------------------------------------------------------------------------
----------
"Daniel" <no@junk.com> a écrit dans le message de news:
%23cWK4VWXGHA.4716@TK2MSFTNGP02.phx.gbl...
> Salut
> Je dois creer un bouton qui incremente et decremente une valeur dans un
> textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner)
ne
> me
> conviennent pas.
>
> Tout fonctionne excepté que si on déplace le curseur a l'extérieur des
> zones
> du bouton le textbox continue a s'incrémenté malgré tout.
>
> Alors ma question, est que je voudrais vérifier si ma souris est
toujours
> sur le bouton lorsque j'incrémente
>
> Merci
>
> Voici un exemple
>
> Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer,
Shift
> As
> Integer, x As Single, y As Single)
> Dim t#
> MouseDown = True
> If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
> Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
> End If
> While MouseDown = True And Timer - t < 0.4 And Timer >= t
> DoEvents
> Wend
>
> While MouseDown = True
> If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then
> Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00")
> End If
> t = Timer
> Do While Timer - t < 0.04 And Timer >= t
> DoEvents
> Loop
> Wend
>
> 'suite de mon code une fois le bouton relaché
> End Sub
>
> Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift
As
> Integer, x As Single, y As Single)
> MouseDown = False
>
> End Sub
>
>
Merci mais ca fonctionne pas comme je le veux cet evenement j'ai finalement trouvé
j'ai utilisé 2 fonction API pour lire la position de la souris
public Declare Function GetCursorPos Lib "user32" (lpPoint As PointAPI) As Long Public Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As PointAPI) As Long
Type PointAPI X As Long Y As Long End Type
While MouseDown = True Call GetCursorPos(MousePos) ScreenToClient BDownValue(Index).hwnd, MousePos If MousePos.X >= 0 And MousePos.X < BDownValue(Index).Width / 15 _ And MousePos.Y >= 0 And MousePos.Y < BDownValue(Index).Height / 15 Then If Val(Batcher(Index).Text) - 0.01 >= 0.5 Then Batcher(Index).Text = Format(Val(Batcher(Index).Text) - 0.01, "0.00") End If t = Timer While Timer - t < 0.04 And Timer >= t DoEvents Wend End If DoEvents Wend
"X" a écrit dans le message de news:
Bonjour,
Voix l'évènement:
Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) ' X et Y sont la position End Sub
-- Merci beaucoup, au revoir et à bientôt :o) ------ Site logiciels http://irolog.free.fr Mail http://irolog.free.fr/ecrire/index.htm Site perso http://irolog.free.fr/joe/index.htm Principe d'utilisation des news Groups http://support.microsoft.com/directory/worldwide/fr/newsgroup/regles.htm --------------------------------------------------------------------------
----------
"Daniel" a écrit dans le message de news: % > Salut > Je dois creer un bouton qui incremente et decremente une valeur dans un > textbox a l'aide de bouton car ceux fourni dans VB (updown,et spinner)
ne
> me > conviennent pas. > > Tout fonctionne excepté que si on déplace le curseur a l'extérieur des > zones > du bouton le textbox continue a s'incrémenté malgré tout. > > Alors ma question, est que je voudrais vérifier si ma souris est
toujours
> sur le bouton lorsque j'incrémente > > Merci > > Voici un exemple > > Private Sub BUPValue_MouseDown(Index As Integer, Button As Integer,
Shift
> As > Integer, x As Single, y As Single) > Dim t# > MouseDown = True > If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then > Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") > End If > While MouseDown = True And Timer - t < 0.4 And Timer >= t > DoEvents > Wend > > While MouseDown = True > If Val(Batcher(Index).Text) + 0.01 <= 1.5 Then > Batcher(Index).Text = Format(Val(Batcher(Index).Text) + 0.01, "0.00") > End If > t = Timer > Do While Timer - t < 0.04 And Timer >= t > DoEvents > Loop > Wend > > 'suite de mon code une fois le bouton relaché > End Sub > > Private Sub BUPValue_MouseUp(Index As Integer, Button As Integer, Shift
As
> Integer, x As Single, y As Single) > MouseDown = False > > End Sub > >