Klovis Posted June 29, 2011 Share Posted June 29, 2011 I want it so that when the slider is 20 to 50 it'll hide the test gui. what am I doing wrong and how do I fix it? -Klovis #include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("1", 105, 47, 192, 114) $Slider1 = GUICtrlCreateSlider(0, 0, 102, 45) $hSlider = GUICtrlGetHandle($Slider1) GUICtrlSetLimit($Slider1, 100, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $testgui = GUICreate("test", 100,100,0,0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_HSCROLL, "hscroll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func hscroll($hWnd, $iMsg, $iwParam, $ilParam) #forceref $v = GUICtrlRead($Slider1) Local $i If $ilParam = $hSlider Then If $v > 20 And $v < 50 Then $i = 2 If $i = 2 Then $showandhide = GUICtrlGetState($testgui) GUICtrlSetData($showandhide, @SW_HIDE) GUICtrlSetState($testgui, @SW_HIDE) EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2011 Moderators Share Posted June 29, 2011 Klovis,Take a look at this and see if you can tell me what you were doing wrong before: expandcollapse popup#include <GUIConstantsEx.au3> #include <SliderConstants.au3> #include <WindowsConstants.au3> Global $fVisible = True $Form1 = GUICreate("1", 105, 47, 192, 114) $Slider1 = GUICtrlCreateSlider(0, 0, 102, 45) GUICtrlSetLimit($Slider1, 100, 0) GUISetState(@SW_SHOW) $testgui = GUICreate("test", 100,100,0,0) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_HSCROLL, "hscroll") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func hscroll($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam, $ilParam If GUICtrlRead($Slider1) > 20 Then If $fVisible Then GUISetState(@SW_HIDE, $testgui) $fVisible = False EndIf Else If Not $fVisible Then GUISetState(@SW_SHOW, $testgui) $fVisible = True EndIf EndIf EndFuncM23 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...
Klovis Posted June 29, 2011 Author Share Posted June 29, 2011 Yeah I totally switch the $testgui and @SW_Show around thanks mate!!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 29, 2011 Moderators Share Posted June 29, 2011 Klovis,GUICtrlSetState($testgui, @SW_HIDE) did not help matters either! 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...
lorenkinzel Posted July 4, 2011 Share Posted July 4, 2011 Melba23 As a beginner, I really appreciate seeing this approach to help. Not fixed for the person, but shown how to fix. Nice to see. 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