Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I hide the ToolTipText for a Slider Bar?

Tags:

vba

ms-access

In VBA programming, is it possible to hide the ToolTipText for a Slider Bar?

The picture below shows a Slider Bar on a form in a Microsoft Access database. I would like to hide the ToolTipText in the red circle.

The reason I want to do this is because the Slider Bar cannot show decimal values (example: 0,1), so I want to display the values in a box next to the slider after they are scaled to decimal values. I know how to do this, but not how to hide the ToolTipText for the Slider that shows only integer values.

Slider Bar

like image 201
strcompnice Avatar asked Mar 21 '12 16:03

strcompnice


1 Answers

There is no easy way to remove that indicator as it's not exposed through the control itself.

However, there are a couple of solutions:

  1. Subclassing the control and intercepting Windows messages

    Not for the faint of heart, complex and overkill, but you theoretically could intercept windows messages and drop those that correspond to the tooltip.
    This is not easy in VBA at all, and I wouldn't even try it.
    If you feel like delving into this, have a look at an example in KB278379

  2. Just display something else.

    More interesting is the ability to change the displayed text to something else:

    Slider with custom text

    To change the text, handle the Scroll event and update the slider's Text property:

    Private Sub MySlider_Scroll()
        MySlider.Text = "Awesomeness: " & (MySlider.Value * 7.89)
    End Sub
    

    The event is not visible from the control's properties themselves, but if you open the IDE and select the Slider from the list of controls, you will be able to create the code for handling the Scroll event:

    Scroll Event handler

like image 144
Renaud Bompuis Avatar answered Oct 13 '22 05:10

Renaud Bompuis