• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 204
  • Last Modified:

How to control how the slider bar applied the commands


I am adding a slider bar to an application. Is there a way that I can tell when the value has changed and exh time it changes it undoes the last function and applies the new one. The code I am using looks like this
Dim text1 As String
Dim text2 As String
Dim title2 As String * 13
Dim sliderval As Integer

ret = IpDocGetStr(INF_NAME, DOCSEL_ACTIVE, title)
 text1 = title
 text2 = orig

If text1 = text2 Then
sliderval = Guihigh.Slider1.Value

ret = IpWsOverlay(overlay, sliderval, 0)

I need the slider val to be one function between two images at the moment it changes each time it is moved but then keeps applying the function rather than just changing it.
Any help appreciated.
1 Solution
Not exactly sure what you mean, but assuming you are using the Microsoft Common Controls
(from components->Microsoft Common Controls, i.e., MSCOMCTL.OCX)

then the Slider1_mouseMove event is called any time the slider is moved.

So if I understand what you are asking, -- you are saying -- if the slider changes value (i.e.,
from 10 to 11), then you want to call a function to do something. If that is the case, then you
would do this. Add a textbox, and a slider to your form. Then add this code:

Dim previousSlideValue as Integer

Private Sub Form_Load()
previousSlideValue = -1
end sub

Private Sub Slider1_MouseMove(Button as Integer, Shift as Integer, x as Single, y as Single)
  if previousSlideValue <> slider1.value then
     previousSlideValue = slider1.value
     ' CALL YOUR FUNCTION HERE! I.E., displaying a value in a textbox!
     text1.text = slider1.value
  end if

End Sub
eneateAuthor Commented:

Thanks for the feedback. It 's all now working fine and you gave me some new ideas.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now