Hi Everyone,
Thanks klaus for the guidance.
Here's what I came up with:
I set the timer here.
Sub Activity_Resume
' Restore the state this activity was in prior to exiting it.
'------------------------------------------------------------
StateManager.RestoreState(Activity, "Main", 0)
' This timer is for the volume up and down buttons.
' The user can hold down on them to make the SeekBar
' value go up and down.
'---------------------------------------------------
tmrVolumeRepeat.Initialize("tmrVolumeRepeat", 50)
End Sub
These are for the pressing of the up and down buttons.
Sub ButtonVolumeDown_Down
blnVolumeDownIsHeldDown = True
tmrVolumeRepeat.Enabled = True
End Sub
Sub ButtonVolumeDown_Up
blnVolumeDownIsHeldDown = False
tmrVolumeRepeat.Enabled = False
End Sub
Sub ButtonVolumeUp_Down
blnVolumeUpIsHeldDown = True
tmrVolumeRepeat.Enabled = True
End Sub
Sub ButtonVolumeUp_Up
blnVolumeUpIsHeldDown = False
tmrVolumeRepeat.Enabled = False
End Sub
Here is the timer event.
Sub tmrVolumeRepeat_Tick
If blnVolumeDownIsHeldDown Then
' Decrease seek bar value.
'-------------------------
SeekBarVolume.Value = SeekBarVolume.Value - 1
Else
' Increase seek bar value.
'-------------------------
SeekBarVolume.Value = SeekBarVolume.Value + 1
End If
End Sub
I works most of the time but sometimes it takes several seconds for the SeekBar to move. Not sure why, but I hope my users will like this new feature to fine tune the SeekBar position with buttons.
If anyone knows how to make the movement and response smooth please show me what else to do to my coding.
Erel,
Maybe a repeat event would be nice in the next version of B4A ?
Thanks again.