Ahmed97 Posted May 31, 2011 Share Posted May 31, 2011 (edited) Hi Bros, i have problem with this script im making program and i want press button in the program that set trans for the program. look to script.... expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> $Test = GUICreate("Test", 263, 81, 391, 374) $exit = GUICtrlCreateButton("Exit", 144, 24, 75, 25, $WS_GROUP) $SetTrans = GUICtrlCreateButton("Set Trans", 40, 24, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $exit Exit Case $SetTrans $SliderWin = GUICreate("", 116, 317, 403, 214) $Group1 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313) $Slider = GUICtrlCreateSlider(40, 16, 54, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH)) GUICtrlSetLimit(-1, 255, 0) GUICtrlSetData(1, 255) $Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) $Prev = GUICtrlRead($Slider) While 1 $Data = GUICtrlRead($Slider) If $Data <> $Prev Then GUICtrlSetData($Label, $Data) $Prev = $Data EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ; Proplem is here Exit ; Here too EndSwitch WEnd EndSwitch WEnd When i press " Set Trans " button its open the new window and all things work 100% ; Proplem here, but when i press X to close the window the main program closing with it, i want when i press X close the Trans Window only not the program. Please Help :S Sorry For Bad English Edited May 31, 2011 by TheMaster Link to comment Share on other sites More sharing options...
ahmet Posted May 31, 2011 Share Posted May 31, 2011 Repleace thisExit ; Here too with this GUIDelete($SliderWin) ExitLoopLook also here. Link to comment Share on other sites More sharing options...
Ahmed97 Posted May 31, 2011 Author Share Posted May 31, 2011 with this GUIDelete($SliderWin) ExitLoop This is working, many thnx Link to comment Share on other sites More sharing options...
Ahmed97 Posted May 31, 2011 Author Share Posted May 31, 2011 another question... Can i write the code by another way that can Read the Slider from 0 to 255 and set transparency to the degree where the slider on ? another meaning.. $Prev = GUICtrlRead($Slider) While 1 $Data = GUICtrlRead($Slider) If $Data <> $Prev Then GUICtrlSetData($Label, $Data) $Prev = $Data If $Data = 50 Then ; Here's the proplem WinSetTrans("Test", "", 50) ; here too EndIf ;;;; EndIf in that code above dont change the trans in any degree just the D-50 ( Degree ) change the trans to 50 expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> $Test = GUICreate("Test", 263, 81, 391, 374) $exit = GUICtrlCreateButton("Exit", 144, 24, 75, 25, $WS_GROUP) $SetTrans = GUICtrlCreateButton("Set Trans", 40, 24, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $exit Exit Case $SetTrans $SliderWin = GUICreate("", 116, 317, 403, 214) $Group1 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313) $Slider = GUICtrlCreateSlider(40, 16, 54, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH)) GUICtrlSetLimit(-1, 255, 50) GUICtrlSetData(1, 255) $Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) $Prev = GUICtrlRead($Slider) While 1 $Data = GUICtrlRead($Slider) If $Data <> $Prev Then GUICtrlSetData($Label, $Data) $Prev = $Data If $Data = 50 Then ; Here's the proplem WinSetTrans("Test", "", 50) ; here too EndIf ;;;; EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE GUIDelete($SliderWin) ExitLoop EndSwitch WEnd EndSwitch WEnd Link to comment Share on other sites More sharing options...
ahmet Posted May 31, 2011 Share Posted May 31, 2011 Remove If block and add WinSetTrans($Test,"",$Data) or maybe I haven't understood well. Link to comment Share on other sites More sharing options...
Ahmed97 Posted May 31, 2011 Author Share Posted May 31, 2011 (edited) it's dont work..listen, want make the slider like the volume slider if u decreased it 1degree the sound decrease 1degree not mute the sound..here's same ( slider now on 50 degree ) the program now very transparent so i want increase slider degree to 255 to see the program well. the question is : Must i write If $Data = 50 Then WinSetTrans("Test", "", 50) If $Data = 100 Then WinSetTrans("Test", "", 100) EndIf EndIf and so on ?? Edited May 31, 2011 by TheMaster Link to comment Share on other sites More sharing options...
pieeater Posted May 31, 2011 Share Posted May 31, 2011 this is how i got the slider working on the trans, i changed it so the trans cant make the gui invisible so you can still close the gui expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <SliderConstants.au3> #include <StaticConstants.au3> $Test = GUICreate("Test", 263, 81, 391, 374) $exit = GUICtrlCreateButton("Exit", 144, 24, 75, 25, $WS_GROUP) $SetTrans = GUICtrlCreateButton("Set Trans", 40, 24, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $exit Exit Case $SetTrans $SliderWin = GUICreate("Trans window", 116, 317, 403, 214) $Group1 = GUICtrlCreateGroup("Transperancy", 16, 0, 89, 313) $Slider = GUICtrlCreateSlider(40, 16, 54, 269, BitOR($TBS_VERT, $TBS_AUTOTICKS, $TBS_BOTH)) GUICtrlSetLimit(-1, 255, 20) GUICtrlSetData(1, 255) $Label = GUICtrlCreateLabel("255", 34, 288, 52, 17, $SS_CENTER) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) GUICtrlSetData($Slider, 255) $Prev = GUICtrlRead($Slider) While 1 $Data = GUICtrlRead($Slider) If $Data <> $Prev Then GUICtrlSetData($Label, $Data) If $Data > 20 Then WinSetTrans("Trans window", "", $Data) $Prev = $Data EndIf $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ; Proplem is here Exit ; Here too EndSwitch WEnd EndSwitch WEnd [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
Ahmed97 Posted May 31, 2011 Author Share Posted May 31, 2011 thnxxxx bro working 100% 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