Jump to content
Sign in to follow this  
Madza91

Transparency with slider, made that way... when i stop pushing the button - child turns off.

Recommended Posts

Madza91

I want to make slider like on Win XP for Volume.. and i maded that but with error, when move slider than is ok but when i stop pushing the slider dissapear GUI and child but i want to dissapear only child, where is the error ?

#include <GuiConstants.au3>
$initran = Iniread("transparent.ini","1","transparent","255")
$gui = GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Button_1 = GuiCtrlCreateButton("Transparent", 100, 170, 180, 50)

WinSetTrans($gui,"",$initran)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button_1
        tran()
    Case Else
    ;;;
    EndSelect
WEnd
Exit

Func tran()
$mpos = MouseGetPos()
$child4 = GUICreate("Sliding Toolbar", 75, 130, $mpos[0] - 81, $mpos[1] - 136, $WS_POPUP, $WS_EX_DLGMODALFRAME,$gui)
$trans = GUICtrlCreateLabel("Transparent",0,7,75,15,$SS_CENTER)
$Slider = GuiCtrlCreateSlider(25, 24, 26, 81,Bitor($TBS_VERT,$TBS_BOTH,$TBS_NOTICKS))
$button = GUICtrlCreateButton("Iskljuci",5,110,60,20)
GUICtrlSetLimit($Slider, 255, 1)
GUICtrlSetData($Slider, $initran)
GUISetState()

$old1 = GUICtrlRead($Slider)
While 1
    If GUICtrlRead($Slider) <> $old1 Then
        WinSetTrans($gui, "", GUICtrlRead($Slider))
        $old1 = GUICtrlRead($Slider)
    EndIf   
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            $t = GUICtrlRead($Slider)
            IniWrite("transparent.ini","1","transparent",$t)
        Case $msg = $Slider
            GUIDelete($child4)
    EndSelect
WEnd
EndFunc

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites
Nahuel

Add ExitLoop after GUIDelete($child4)

Share this post


Link to post
Share on other sites
Madza91

Yea.. ty man :P


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
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
Sign in to follow this  

×