Sign in to follow this  
Followers 0
nicdev007

Slider tooltip: Removing the tooltip text

5 posts in this topic

#1 ·  Posted (edited)

Hi All,

I have been following this thread from rasim as well as this one from Achilles and rover, and I must say I still don't have any luck to "remove" or "hide" the tooltip text. I can successfully change the title as rover suggested, but I have tried and failed to remove text. Here is a sample of the code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiSlider.au3>
#include <SliderConstants.au3>
#include <GuiEdit.au3>
#include <GuiToolTip.au3>
#include <ToolTip_UDF.au3>
GUIRegisterMsg($WM_HSCROLL, "WM_H_Slider")
Global $TicArray[5] = [5, 30, 50, 70, 90]
Global $Slider, $hSlider, $hWndTT, $Dummy, $iBuffer
Local $oldpos = 0
; Create GUI
$tGUI = GUICreate("Slider Set Tic", 400, 296)
$hSlider = GUICtrlCreateSlider(2, 2, 396, 20, BitOR($TBS_TOOLTIPS, $TBS_BOTH, $TBS_ENABLESELRANGE))
$edit = GUICtrlCreateEdit("--", 50, 50)
GUISetState()
_GUICtrlSlider_ClearTics($hSlider)
; Set Tics
ArrayTicks($TicArray, $hSlider)
$hWndTT = _GUICtrlSlider_GetToolTips($hSlider)
;_GUICtrlSlider_SetTicFreq($hSlider, 1) ; set tics divisor
_GUICtrlSlider_SetTipSide($hSlider, $TBTS_TOP)
_GUIToolTip_SetTitle($hWndTT, "Value 0")
_GUIToolTip_SetMargin($hWndTT, -5, -5, -5, -20); <-- Does not change anything

_GUIToolTip_SetTipTextColor($hWndTT, 0xFFFFFF); <-- Does not change anything
;_ToolTip_SetTextColor($hWndTT, 0x282A98)
_GUIToolTip_SetTipBkColor($hWndTT, 0x985428); <-- Does not change anything
;_ToolTip_SetBkColor($hWndTT, 0x985428)
$Dummy = GUICtrlCreateDummy()
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
  Case $Dummy
   _Slider()
    EndSwitch
WEnd
; Create array tics
Func ArrayTicks($array, $CurrentSlider)
    Local $iMax = UBound($array), $i
    For $i = 0 To $iMax - 1
        _GUICtrlSlider_SetTic($CurrentSlider, $array[$i])
    Next
EndFunc   ;==>ArrayTicks

Func WM_H_Slider($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam
    Local $iValue
Local $iCode = BitAND($wParam, 0xFFFF)
;ConsoleWrite("message: " & $wParam & "shifted" & $iCode & @CRLF)
    If $lParam = GUICtrlGetHandle($hSlider) Then
        Local $SliderPos = GUICtrlRead($hSlider)
        If $SliderPos > $oldpos Then
            GUICtrlSetData($edit, "moving right")
            Switch GUICtrlRead($hSlider)
                Case 1 To 5
                    GUICtrlSetData($hSlider, 5)
                Case 6 To 30
                    GUICtrlSetData($hSlider, 30)
                Case 31 To 50
                    GUICtrlSetData($hSlider, 50)
                Case 51 To 70
                    GUICtrlSetData($hSlider, 70)
                Case 71 To 90
                    GUICtrlSetData($hSlider, 90)
                Case 91 To 100
                    GUICtrlSetData($hSlider, 100)
                Case Else
                    GUICtrlSetData($hSlider, 0)
            EndSwitch
            $oldpos = $SliderPos
        ElseIf $SliderPos < $oldpos Then
            GUICtrlSetData($edit, "moving left")
            Switch GUICtrlRead($hSlider)
                Case 0 To 4
                    GUICtrlSetData($hSlider, 0)
                Case 5 To 29
                    GUICtrlSetData($hSlider, 5)
                Case 30 To 49
                    GUICtrlSetData($hSlider, 30)
                Case 50 To 69
                    GUICtrlSetData($hSlider, 50)
                Case 70 To 89
                    GUICtrlSetData($hSlider, 70)
                Case 90 To 99
                    GUICtrlSetData($hSlider, 90)
                Case Else
                    GUICtrlSetData($hSlider, 100)
            EndSwitch
            $oldpos = $SliderPos
        EndIf
    EndIf
GUICtrlSendToDummy($Dummy, GUICtrlRead($hSlider))
Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_H_Slider
Func _Slider()
    Local $iValue, $sValue
    $iValue = GUICtrlRead($Dummy); read dummy control for value of slider
    ConsoleWrite('+$iValue = ' & $iValue & @crlf) ;**
    If $iBuffer <> $iValue Then ; buffer read slider value to prevent unnecessary updating at end of slider range. **
        $iBuffer = $iValue
        If $iBuffer > 200 then $iBuffer = 200
        $iBuffer *= 1
        $sValue = StringFormat("Value: %.f", $iBuffer)
        _GUIToolTip_UpdateTipText($hWndTT, 0, 0, " ") ; <-- Does not change anything
        _GUIToolTip_SetTitle($hWndTT, $sValue) ; set slider tooltip title text
        _GUIToolTip_Update($hWndTT) ; update slider tooltip
        ConsoleWrite('-Value = ' & $iBuffer & @CRLF)
    EndIf
    Return
EndFunc   ;==>_Slider

i have tried both with GuiToolTip.au3 and with ToolTip_UDF.au3, but no such luck.

EDIT: Can it have something to do with the fact that I'm using Win 7 64 bit?

Any help greatly appreciated.

Thank you in advance

Best regards

Edited by nicdev007

[font=Verdana, Helvetica, Arial, sans-serif]Life is too short to worry about the things you don't have or cannot do ...[/font][font=Verdana, Helvetica, Arial, sans-serif]So if you don't know how to do it - Learn it![/font][font=Verdana, Helvetica, Arial, sans-serif]Don't be afraid to ask for help ...[/font]

Share this post


Link to post
Share on other sites



Remove $TBS_TOOLTIPS from the slider creation line.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Remove $TBS_TOOLTIPS from the slider creation line.

Hi BrewManNH, thanks for the reply. Doesn't that remove the tooltip completely? I just want to remove the "text" and keep the title.


[font=Verdana, Helvetica, Arial, sans-serif]Life is too short to worry about the things you don't have or cannot do ...[/font][font=Verdana, Helvetica, Arial, sans-serif]So if you don't know how to do it - Learn it![/font][font=Verdana, Helvetica, Arial, sans-serif]Don't be afraid to ask for help ...[/font]

Share this post


Link to post
Share on other sites

Maybe you need to explain in a clearer fashion what exactly you're trying to do with this script.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Maybe you need to explain in a clearer fashion what exactly you're trying to do with this script.

Yes you are right ... I was not that clear in my description. Look at the image here:

http://imgur.com/kl5Tl

When you look at the tooltip, you see the title "Value: 30" which is what we created in the _Slider function in my code, and just below we have the text part which is the "Slider value" from windows. What I want is to remove the second line, meaning the slider value. Thus I just want the "Value: xx" line to remain.

It was suggested to resize the tooltip, but that does not seem to have an effect. Other have suggested to make the font the same colour as the background, thus not seeing this Integer, but that too does not work for me.

I thank you again for your time, and apologise for my , sloppy description before :-)

Best regards

Nicdev


[font=Verdana, Helvetica, Arial, sans-serif]Life is too short to worry about the things you don't have or cannot do ...[/font][font=Verdana, Helvetica, Arial, sans-serif]So if you don't know how to do it - Learn it![/font][font=Verdana, Helvetica, Arial, sans-serif]Don't be afraid to ask for help ...[/font]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0