Sign in to follow this  
Followers 0
yawoo

Slider Question

3 posts in this topic

I have several question of the slider usage:

1. Drag the slider, increase the value not by 1 only, say by 10 interval.

2. Change the tick interval to a larger value, 1 is too close for large range.

3. See the code attached. When drag the slider, it will trigger to update the input box. Is it possible to trigger the value update constantly when slidding, not just the slidding has been completed.

$hVideoBR = GUICtrlCreateInput ("", $x+$w, $y+$h, $w1)
GUICtrlSetData(-1, 800)
GuiCtrlCreateLabel("100", $x+10,$y+2*$h,20,20)
$hVBRslider = GUICtrlCreateSlider ($x+30,$y+2*$h,130,20,$TBS_NOTICKS)
GUICtrlSetLimit(-1,2000,100)
GUICtrlSetData(-1, 800)
GuiCtrlCreateLabel("2000", $x+160,$y+2*$h,40,20)

GuiSetState()
While 1
   $iMsg = GUIGetMsg()
   Select
      Case $iMsg = $hVBRslider
         GUICtrlSetData($hVideoBR, GUICtrlRead($hVBRslider))
      Case $iMsg = $hVideoBR
         GUICtrlSetData($hVBRslider, GUICtrlRead($hVideoBR))
      Case $iMsg = $GUI_EVENT_CLOSE
         Exit
    EndSelect
Wend

Share this post


Link to post
Share on other sites



#include <GUIConstants.au3>

GUICreate("slider",220,200, 100,200)
GUISetBkColor (0x00E0FFFF) ; will change background color

$slider1 = GUICtrlCreateSlider (10,10,200,20)
GUICtrlSetLimit(-1,200,0)  ; change min/max value
$button = GUICtrlCreateButton ("Value?",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,45); set cursor
$oldvalue = GUICtrlRead($slider1)
$Status = GUICtrlCreateLabel(guictrlread($slider1),1,180,219,20,BitOR($SS_CENTER,$SS_SUNKEN))
GUICtrlSetBkColor($Status,0xbebebe)

Do
  $n = GUIGetMsg ()
    If $oldvalue <> GUICtrlRead($slider1) Then
        $oldvalue = GUICtrlRead($slider1)
        GUICtrlSetData($Status,$oldvalue)
    EndIf
   If $n = $button Then
      MsgBox(0,"slider1",GUICtrlRead($slider1),2)
   EndIf
Until $n = $GUI_EVENT_CLOSE


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thx for gafrost, your sample really solves my third question!

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