unclick event

hi

does anyone know what event is called when you stop pressing left click in your mouse on a command button,i.e. when i hold a click on button it increments the number on a label and when i stop pressing the button the number decrements. any help would be okay

thanks

Comments

  • : hi
    :
    : does anyone know what event is called when you stop pressing left click in your mouse on a command button,i.e. when i hold a click on button it increments the number on a label and when i stop pressing the button the number decrements. any help would be okay
    :
    : thanks
    :
    Hi,
    let's have some form with cmdTest button.
    [code]
    Private KeepRunning As Boolean

    Private Sub Form_Load()
    Me.Caption = 1
    End Sub

    Private Sub Increment()
    While KeepRunning
    Me.Caption = Me.Caption + 1
    DoEvents [green]'Some delay[/green]
    Wend
    End Sub

    Private Sub cmdTest_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    KeepRunning = True
    Increment
    End Sub

    Private Sub cmdTest_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    KeepRunning = False
    End Sub[/code]Is this doing what you expected?
    Guess what happens when some pop-up window appears or when you pres alt+tab? MouseUp will not be raised so you should fix this by some form_lostfocus, cmdTest_lostfocur, form_deactivate or something like that.. (Just set KeepRunning=False there)

    Hope this helps

    [blue][b][italic][size=4]P[/size]avlin [size=4]II[/italic][/size][/b][/blue]

    [purple]Don't take life too seriously anyway you won't escape alive from it![/purple]


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion