Justforfun Posted July 16, 2010 Share Posted July 16, 2010 (edited) Hello, I've been trying to make a slider with min\max values from 0 to 100000 but I cant set it above 30000 without it freezing at 0 so my question is if there is no way to set it to 100000 then is there a way to set the guictrlsetlimit to use 0% to 100% where every 1% = 1000 Iwa doing this $Max = 100000 $Slider1 = GUICtrlCreateSlider(96, 152, 465, 73, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS)) GUICtrlSetLimit($Slider1, $max, 0) How would I change this to % but still get output value of 100000 or is the away to get pass the 30000 limit I hop I was able to explain this well enough. Edited July 16, 2010 by Justforfun Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 16, 2010 Moderators Share Posted July 16, 2010 Justforfun,Here you go! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hSlider = GUICtrlCreateSlider(10, 10, 480, 30) $hSlider_Handle = GUICtrlGetHandle($hSlider) GUICtrlSetLimit($hSlider, 1000, 0) ; 0-1000 here <<<<<<<<<<<<<<<<<<<<<< $hLabel = GUICtrlCreateLabel("", 10, 100, 200, 20) GUISetState() GUIRegisterMsg($WM_HSCROLL, "_Slider_Movement") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Slider_Movement($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam If $lParam = $hSlider_Handle Then ; Calculate value Local $iValue = 100 * GUICtrlRead($hSlider) ; So multiply by 100 here <<<<<<<<<<<<<<<< ; Change label GUICtrlSetData($hLabel, $iValue) EndIf Return $GUI_RUNDEFMSG EndFuncYou can obviously change the Max value and the factor to your own choices.Ask if anything is unclear. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Justforfun Posted July 16, 2010 Author Share Posted July 16, 2010 Justforfun, Here you go! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $hGUI = GUICreate("Test", 500, 500) $hSlider = GUICtrlCreateSlider(10, 10, 480, 30) $hSlider_Handle = GUICtrlGetHandle($hSlider) GUICtrlSetLimit($hSlider, 1000, 0) ; 0-1000 here <<<<<<<<<<<<<<<<<<<<<< $hLabel = GUICtrlCreateLabel("", 10, 100, 200, 20) GUISetState() GUIRegisterMsg($WM_HSCROLL, "_Slider_Movement") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Slider_Movement($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam If $lParam = $hSlider_Handle Then ; Calculate value Local $iValue = 100 * GUICtrlRead($hSlider) ; So multiply by 100 here <<<<<<<<<<<<<<<< ; Change label GUICtrlSetData($hLabel, $iValue) EndIf Return $GUI_RUNDEFMSG EndFunc You can obviously change the Max value and the factor to your own choices. Ask if anything is unclear. M23 You are awesome thanks so very much Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 16, 2010 Share Posted July 16, 2010 (edited) Both the min and max values are packed into a single 32 bit parameter in the message that does the work. So each value is a signed 16-bit integer. That limits you to 32K - 1 for max. The percentage thing is just a little math: #include <GUIConstantsEx.au3> #include <SliderConstants.au3> Global $slider1, $button, $msg, $Max = 2^15 - 1 GUICreate("slider", 400, 300) $slider1 = GUICtrlCreateSlider(20, 25, 360, 50, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS)) GUICtrlSetLimit($slider1, $Max, 0) $slider2 = GUICtrlCreateSlider(20, 100, 360, 50, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS)) GUICtrlSetLimit($slider2, $Max + 1, 0) $slider3 = GUICtrlCreateSlider(20, 175, 360, 50, BitOR($TBS_TOOLTIPS, $TBS_AUTOTICKS)) GUICtrlSetLimit($slider3, 100, 0) $button = GUICtrlCreateButton("Value?", 150, 250, 100, 30) GUISetState() Do $msg = GUIGetMsg() If $msg = $button Then MsgBox(0, "sliders", "Slider1: " & GUICtrlRead($slider1) & @CRLF & _ "Slider2: " & GUICtrlRead($slider2) & @CRLF & _ "Slider3: " & GUICtrlRead($slider3) & "% = " & GUICtrlRead($slider3) * 100000 / 100, 5) EndIf Until $msg = $GUI_EVENT_CLOSE Edit: Too slow for the whirly-bird! Edited July 16, 2010 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 16, 2010 Moderators Share Posted July 16, 2010 PsaltyDS, Thanks for that little bit of info. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Raik Posted October 26, 2010 Share Posted October 26, 2010 (edited) in $wParam is all needed info:BitAND($wParam, 0x0000FFFF) will give you the state of the mouse:while scrolling the slider:$wParam = 0x001D0005state: 5on releasing the mouse:$wParam = 0x00000008state: 8but the first part ("0x001D") contains the value of the slider and thats my question:how to calculate this value from $wParam to a dec value?EDIT:have found the answer by myself:BitShift($wParam, 16) will give the slider-value. Edited October 26, 2010 by Raik AutoIt-Syntaxsheme for Proton & Phase5 * Firefox Addons by me (resizable Textarea 0.1d) (docked JS-Console 0.1.1) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now