retaly Posted October 26, 2012 Share Posted October 26, 2012 (edited) hy guys, almost ready this part of my full scrip, only one small thing what still i couldnt fixing... my problem is: should to Return to 0 on slider when checkbox is off, and slider change to $GUI_DISABLE, $GUI_UNCHECKED as i wrote below in script. expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $Slider_hold Local $slider1, $msg, $lightvalue, $state, $lightslider, $lightlabel, $STATE1 GUICreate("slider", 500, 400) $STATE1 = 0;"UNCHECKED" $lightslider = GUICtrlCreateCheckbox("", 10, 17, 14, 20) $lightlabel = GUICtrlCreateLabel("Light:", 25, 20, 50, 20) $slider1 = GUICtrlCreateSlider(120, 20, 200, 20) GUICtrlSetState(-1, BitOr($GUI_DISABLE, $GUI_UNCHECKED)) GUICtrlSetLimit(-1, 99, 0) ; change min/max value $lightvalue = GUICtrlCreateLabel($state, 65, 20, 13, 20) GUICtrlSetColor(-1, 0xff0000) GUISetState() While 1 Switch GUIGetMsg() Case $lightslider _lightChange() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _lightChange() $State1 = NOT $State1 If $State1 Then GUICtrlSetState($slider1, BitOr($GUI_ENABLE, $GUI_CHECKED)) slider_opt() Else GUICtrlSetState($slider1, BitOr($GUI_DISABLE, $GUI_UNCHECKED)) GUICtrlSetData($lightvalue, "0") EndIf EndFunc Func slider_opt() Do $state = GUICtrlRead($slider1) If $state <> $Slider_hold Then GUICtrlSetData($lightvalue, $state) $Slider_hold = $state EndIf $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE EndFunc Edited October 26, 2012 by retaly Link to comment Share on other sites More sharing options...
FireFox Posted October 26, 2012 Share Posted October 26, 2012 Hi, You have to keep only one While in your script to be able to receive GUI messages from your main while, plus I don't know why you are using the GUI_CHECKED and GUI_UNCHECKED states for the slider... expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $Slider_hold Local $slider1, $msg, $lightvalue, $state, $lightslider, $lightlabel, $STATE1 GUICreate("slider", 500, 400) $STATE1 = 0;"UNCHECKED" $lightslider = GUICtrlCreateCheckbox("0", 10, 17, 14, 20) $lightlabel = GUICtrlCreateLabel("Light:", 25, 20, 50, 20) $slider1 = GUICtrlCreateSlider(120, 20, 200, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetLimit(-1, 99, 0) ; change min/max value $lightvalue = GUICtrlCreateLabel($state, 65, 20, 13, 20) GUICtrlSetColor(-1, 0xff0000) GUISetState() While 1 Switch GUIGetMsg() Case $lightslider _lightChange() Case $slider1 GUICtrlSetData($lightvalue, GUICtrlRead($slider1)) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _lightChange() $STATE1 = Not $STATE1 If $STATE1 Then GUICtrlSetState($slider1, $GUI_ENABLE) Else GUICtrlSetState($slider1, $GUI_DISABLE) GUICtrlSetData($slider1, 0) GUICtrlSetData($lightvalue, "0") EndIf EndFunc ;==>_lightChange Br, FireFox. Link to comment Share on other sites More sharing options...
retaly Posted October 26, 2012 Author Share Posted October 26, 2012 using GUI_CHECKED and GUI_UNCHECKED for checkbox,tested and now slider doesnt working with 3rd mouse button, its important to me, Link to comment Share on other sites More sharing options...
FireFox Posted October 26, 2012 Share Posted October 26, 2012 using GUI_CHECKED and GUI_UNCHECKED for checkbox,You were using it for the slider.tested and now slider doesnt working with 3rd mouse button, its important to me, What do you want it to do? I don't have a mouse on my computer right now.Br, FireFox. Link to comment Share on other sites More sharing options...
retaly Posted October 26, 2012 Author Share Posted October 26, 2012 (edited) the 3rd button is one roller button, i'd like to use it with mouse click, and with 3rd roller button too i hope u are understanding me Edited October 26, 2012 by retaly Link to comment Share on other sites More sharing options...
retaly Posted October 26, 2012 Author Share Posted October 26, 2012 (edited) i mean, need there the slider_op() to working 3rd mouse, but in this situation i went one step to forward, and two step to back.. because 3rd mouse button again working, but doesnt return to 0 and gui_disable to slider... :// i have to find the best way to use both option in one option what works... try out the two different script then you will understand it if still dont. Edited October 26, 2012 by retaly Link to comment Share on other sites More sharing options...
FireFox Posted October 26, 2012 Share Posted October 26, 2012 You can not trap the slider scroll event in autoit (or nobody has given the solution) so you have to check for its value like you did : expandcollapse popup#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Local $slider1, $lightvalue, $lightslider, $lightlabel, $STATE1 = False Local $iSliderValue = -1, $iLastSliderValue = 0 GUICreate("slider", 500, 400) $lightslider = GUICtrlCreateCheckbox("0", 10, 17, 14, 20) $lightlabel = GUICtrlCreateLabel("Light:", 25, 20, 50, 20) $slider1 = GUICtrlCreateSlider(120, 20, 200, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetLimit(-1, 99, 0) ; change min/max value $lightvalue = GUICtrlCreateLabel("0", 65, 20, 13, 20) GUICtrlSetColor(-1, 0xff0000) GUISetState() While 1 Switch GUIGetMsg() Case $lightslider _lightChange() Case $GUI_EVENT_CLOSE Exit EndSwitch If $STATE1 Then $iSliderValue = GUICtrlRead($slider1) If $iSliderValue <> $iLastSliderValue Then GUICtrlSetData($lightvalue, $iSliderValue) $iLastSliderValue = $iSliderValue EndIf EndIf WEnd Func _lightChange() $STATE1 = Not $STATE1 If $STATE1 Then GUICtrlSetState($slider1, $GUI_ENABLE) Else GUICtrlSetState($slider1, $GUI_DISABLE) GUICtrlSetData($slider1, 0) GUICtrlSetData($lightvalue, "0") EndIf EndFunc ;==>_lightChange Br, FireFox. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 26, 2012 Moderators Share Posted October 26, 2012 FireFox, You can not trap the slider scroll event in autoitOh yes you can: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Local $slider1, $lightvalue, $lightslider, $lightlabel, $STATE1 = False Local $iSliderValue = -1, $iLastSliderValue = 0 GUICreate("slider", 500, 400) $lightslider = GUICtrlCreateCheckbox("0", 10, 17, 14, 20) $lightlabel = GUICtrlCreateLabel("Light:", 25, 20, 50, 20) $slider1 = GUICtrlCreateSlider(120, 20, 200, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetLimit(-1, 99, 0) ; change min/max value $lightvalue = GUICtrlCreateLabel("0", 65, 20, 13, 20) GUICtrlSetColor(-1, 0xff0000) GUISetState() GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL") ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< While 1 Switch GUIGetMsg() Case $lightslider _lightChange() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _lightChange() $STATE1 = Not $STATE1 If $STATE1 Then GUICtrlSetState($slider1, $GUI_ENABLE) Else GUICtrlSetState($slider1, $GUI_DISABLE) GUICtrlSetData($slider1, 0) GUICtrlSetData($lightvalue, "0") EndIf EndFunc ;==>_lightChange ; React to slider movement Func _WM_HSCROLL($hWnd, $iMsg, $wParam, $lParam) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< #forceref $hWnd, $iMsg If $lParam = GUICtrlGetHandle($slider1) Then If BitAND($wParam, 0xFFFF) = 5 Then ; LoWord = $SB_THUMBTRACK GUICtrlSetData($lightvalue, GUICtrlRead($slider1)) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_HSCROLL 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...
Blue_Drache Posted October 26, 2012 Share Posted October 26, 2012 (edited) GuiCtrlRead() the state of the checkbox and set the slider's value with GuiCtrlSetData() appropriately. I see I was beat out, slightly. Edited October 26, 2012 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
FireFox Posted October 26, 2012 Share Posted October 26, 2012 @M23 You forgot to add "or nobody has given the solution" in your quote Do you remember the PM I sent you about my scrollbars problem, at least the event problem ? So, the event is not working for me... f*cking computers. Link to comment Share on other sites More sharing options...
retaly Posted October 26, 2012 Author Share Posted October 26, 2012 I will try out asap ur fixed versions guys, when im at home, thank you very much Link to comment Share on other sites More sharing options...
retaly Posted October 27, 2012 Author Share Posted October 27, 2012 FireFox Thank You Very Much, its working, i wanted that! 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