Sign in to follow this  
Followers 0
Lej

slider ticfreq help

2 posts in this topic

I can for the love of some random holy object not figure out how _GUICtrlSliderSetTicFreq() works.

I want to create a slider with the intervall -5 to 5 and a ticmark at every value.

What's wrong with this?

$slider = GUICtrlCreateSlider(10, 10+($i-1)*50, 200, 40)
GUICtrlSetLimit(-1,5,-5) ; change min/max value
_GUICtrlSliderSetTicFreq(-1,1) ; set ticfreq

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Derived from HelpFile Example:

#include <GUIConstants.au3>
#include <GuiSlider.au3>

opt('MustDeclareVars', 1)

Dim $Gui_Slider, $slider1, $button, $msg, $h_slider, $Status

$Gui_Slider = GUICreate("Slider Set Tic Freq", 220, 100, 100, 200)
GUISetBkColor(0x00E0FFFF)  ; will change background color

$slider1 = GUICtrlCreateSlider(10, 10, 200, 20)
GUICtrlSetLimit(-1, 5, -5) ; change min/max value
$button = GUICtrlCreateButton("Set Freq", 75, 55, 70, 20)
GUISetState()
GUICtrlSetData($slider1, 3) ; set cursor
$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")
$Status = GUICtrlCreateLabel("Num of Tics: " & _GUICtrlSliderGetNumTics ($h_slider), 0, 80, 220, 20, BitOR($SS_SUNKEN, $SS_CENTER))
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $button
         _GUICtrlSliderSetTicFreq ($h_slider, 1)
         GUICtrlSetData($Status, "Num of Tics: " & _GUICtrlSliderGetNumTics ($h_slider))
   EndSelect
WEnd
oÝ÷ Ù±!?Ûjëh×6$h_slider = ControlGetHandle($Gui_Slider, "", "msctls_trackbar321")

Explanation: For _GUICtrlSliderSetTicFreq() you need real control handle and not -1

Edited by Zedna

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