How to control how the slider bar applied the commands

Posted on 2006-03-28
Last Modified: 2010-04-07

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.
Question by:eneate
    LVL 11

    Accepted 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

    Author Comment


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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now