Jump to content

Slider Focus


megahyperion
 Share

Recommended Posts

I put a slider control in a new project im working on.

Man I love this thing and dont know why I didnt see it before.

Here is the slider by itself

$slider1 = GuiCtrlCreateSlider (10,10,200,40)
GUICtrlSetLimit(-1,3,1)

Its a 3 position slider with the minimum position representing 1 and max 3, 2 is obviously in the center.

Is there a way to bring focus to the 2, or the center of the slider?

Right now when I load up my gui is always fosuces to the far left, so right now it starts up fosued on the 1.

Also why is the max height at something around 40? after you increase the height any further the slider doesnt get any bigger.

Thanks

Link to comment
Share on other sites

  • Developers

$slider1 = GuiCtrlCreateSlider (10,10,200,60)

GUICtrlSetLimit(-1,3,1)

GUICtrlSetData(-1,2)

will set the slider to the middle position....

The Height of the control does get bigger but not the slider itself... don't know if thats an internal thing or not.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

BIG SLIDER:

Global $WM_USER = 0x400;
Global $TBM_SETTHUMBLENGTH = $WM_USER + 27
Global $TBS_FIXEDLENGTH = 0x40

GuiCreate("foo")
$slider1 = GuiCtrlCreateSlider (10,10,200,60, $TBS_FIXEDLENGTH)
GUICtrlSetLimit(-1,3,1) 
GuiCtrlSetData($slider1, 2)

GuiSendMsg($slider1, $TBM_SETTHUMBLENGTH, 50, 0)

GuiSetState()
While GUIGetMsg() <> -3
wend
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Here's a wrapper function to create "big" sliders.... I'm working on some other wrappers for slider controls.

$gui = GuiCreate("Example Sliders")
$sliderNormal = GUICtrlCreateSlider(10, 10, 200, 60, -1)
$sliderBig = _GUICtrlCreateSlider(10, 100, 200, 60, -1)

GuiSetState()
While GUIGetMsg() <> -3
WEnd

; Overcome the "feature" that the thumb does not automatically
;   resize larger than approx. 30 pixels by deault
Func _GuiCtrlCreateSlider($left, $top, $width, $height, $style)
   Local $ref = GuiCtrlCreateSlider($left, $top, $width, $height)
   If $style <= 0 Then $style = 0x50020001;the deault style
   GuiCtrlSetStyle($ref, BitOr($style,0x40));TBS_FIXEDLENGTH
   GuiSendMsg($ref, 27+0x400, $height - 10, 0);TBS_SETTHUMBLENGTH
   Return $ref
EndFunc
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...