Jump to content

GUICtrlCreateSlider()


Recommended Posts

Is there a way I can reverse the min and max for a slider, so instead from left to right or up to down its right/left and down/up?

Also the ClassNameNN for an AutoIt slider is msctls_trackbar321, can AutoIt also create/support msctls_trackbar322? Such as the up/down's in the tray volume window.

qq

Link to comment
Share on other sites

#include <GUIConstants.au3>

Global Const $TBS_REVERSED = 0x200

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

$slider1 = GUICtrlCreateSlider (10,10,20,200,BitOR($TBS_VERT,$TBS_REVERSED))
GUICtrlSetLimit(-1,200,0); change min/max value
$button = GUICtrlCreateButton ("Value?",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,45); set cursor

$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $button Then
      MsgBox(0,"slider1",GUICtrlRead($slider1),2)
   $start=TimerInit()
   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.

 

Link to comment
Share on other sites

Thanks for reply Gary but no go :), for me anyway. I had already tried using the TBS_REVERSED style but it didn't work, nor does this, does the above work for you?

I'm running XP PRO SP 2, tested with v3.1.1.53.

Edited by Burrup

qq

Link to comment
Share on other sites

Nope, but read a little more, from MSDN:

TBS_REVERSED

Version 5.80.This style bit is used for "reversed" trackbars, where a smaller number indicates "higher" and a larger number indicates "lower." It has no effect on the control; it is simply a label that can be checked to determine whether a trackbar is normal or reversed.

If I get time I'll look into how to check for that, unless a dev has an answer.

SciTE for AutoItDirections for Submitting Standard UDFs

 

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

 

Link to comment
Share on other sites

#include <GUIConstants.au3>

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

$slider1 = GUICtrlCreateSlider (10,10,20,200,BitOR($TBS_AUTOTICKS,$TBS_VERT))
GUICtrlSetLimit(-1,0,-100)  ; change min/max value
$button = GUICtrlCreateButton ("Value?",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,-45); set cursor

$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $button Then
      MsgBox(0,"slider1",Int(GUICtrlRead($slider1)) * -1,2) 
   $start=TimerInit()
   EndIf
Until $n = $GUI_EVENT_CLOSE
GUIDelete($My_GUI)

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

$slider1 = GUICtrlCreateSlider (10,10,200,20)
GUICtrlSetLimit(-1,0,-100)  ; change min/max value
$button = GUICtrlCreateButton ("Value?",75,70,70,20)
GUISetState()
GUICtrlSetData($slider1,-45); set cursor

$start=TimerInit()
Do
  $n = GUIGetMsg ()
     
   If $n = $button Then
      MsgBox(0,"slider1",Int(GUICtrlRead($slider1)) * -1,2)
   $start=TimerInit()
   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.

 

Link to comment
Share on other sites

Blah, thanks again Gary, I didn't think to do that lol.

Instead of changing the value to a negative and multiplying it by -1 etc I'm just going to do...

GUICtrlSetLimit(-1,200,0) ; change min/max value
;....
   If $n = $button Then
      MsgBox(0,"slider1",200 - GUICtrlRead($slider1) ,2)
;....
Edited by Burrup

qq

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...