Jump to content

Exitloop


 Share

Recommended Posts

ok i have a problem:

when exit is pressed on my Set transparency window it closes whole program even tho is ment to just exit that loop:

Here my code:(well part of it)

#include <GUIConstants.au3>

$Form1 = GUICreate("test", 500, 541)
$transparency = GUICtrlCreateButton("Set Transparency", 80, 515, 95, 25, 0)
GUISetState(@SW_SHOW)

While 1
 $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
           Exit
        Case $transparency
            transparency()
    EndSwitch
WEnd


Func transparency()
$Form2 = GUICreate("Set transparency.", 345, 80, 191, 109)
$Slider1 = GUICtrlCreateSlider(32, 32, 281, 41)
$Label1 = GUICtrlCreateLabel("Move the Slider Across the bar to make the window more transparent", 8, 8, 329, 17)
GUISetState(@SW_SHOW)


GUICtrlSetLimit($Slider1, 5, 1)

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Slider1
            $TransLevel = GUICtrlRead($Slider1)
            Switch $TransLevel
                Case 1
                    WinSetTrans($Form1, "", 255)
                Case 2
                    WinSetTrans($Form1, "", 200)
                Case 3
                    WinSetTrans($Form1, "", 150)
                Case 4
                    WinSetTrans($Form1, "", 100)
                Case 5
                    WinSetTrans($Form1, "", 50)
                Case 6
                    WinSetTrans($Form1, "", 0)
            EndSwitch
    EndSwitch
WEnd
EndFunc

any ideas

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("test", 500, 541)
$transparency = GUICtrlCreateButton("Set Transparency", 80, 515, 95, 25, 0)
GUISetState(@SW_SHOW)

While 1
 $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUI_EVENT_CLOSE
           If $nMsg[1] = $Form1 then Exit
        Case $transparency
            transparency()
    EndSwitch
WEnd


Func transparency()
$Form2 = GUICreate("Set transparency.", 345, 80, 191, 109)
$Slider1 = GUICtrlCreateSlider(32, 32, 281, 41)
$Label1 = GUICtrlCreateLabel("Move the Slider Across the bar to make the window more transparent", 8, 8, 329, 17)
GUISetState(@SW_SHOW)


GUICtrlSetLimit($Slider1, 5, 1)

While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $GUI_EVENT_CLOSE
            If $Msg[1] = $Form2 then ExitLoop(1)
        Case $Slider1
            $TransLevel = GUICtrlRead($Slider1)
            Switch $TransLevel
                Case 1
                    WinSetTrans($Form1, "", 255)
                Case 2
                    WinSetTrans($Form1, "", 200)
                Case 3
                    WinSetTrans($Form1, "", 150)
                Case 4
                    WinSetTrans($Form1, "", 100)
                Case 5
                    WinSetTrans($Form1, "", 50)
                Case 6
                    WinSetTrans($Form1, "", 0)
            EndSwitch
    EndSwitch
WEnd
GuiDelete($form2)
EndFunc

Link to comment
Share on other sites

#include <GUIConstants.au3>

$Form1 = GUICreate("test", 500, 541)
$transparency = GUICtrlCreateButton("Set Transparency", 80, 515, 95, 25, 0)
GUISetState(@SW_SHOW)

While 1
 $nMsg = GUIGetMsg(1)
    Switch $nMsg[0]
        Case $GUI_EVENT_CLOSE
           If $nMsg[1] = $Form1 then Exit
        Case $transparency
            transparency()
    EndSwitch
WEnd
Func transparency()
$Form2 = GUICreate("Set transparency.", 345, 80, 191, 109)
$Slider1 = GUICtrlCreateSlider(32, 32, 281, 41)
$Label1 = GUICtrlCreateLabel("Move the Slider Across the bar to make the window more transparent", 8, 8, 329, 17)
GUISetState(@SW_SHOW)
GUICtrlSetLimit($Slider1, 5, 1)

While 1
    $Msg = GUIGetMsg(1)
    Switch $Msg[0]
        Case $GUI_EVENT_CLOSE
            If $Msg[1] = $Form2 then ExitLoop(1)
        Case $Slider1
            $TransLevel = GUICtrlRead($Slider1)
            Switch $TransLevel
                Case 1
                    WinSetTrans($Form1, "", 255)
                Case 2
                    WinSetTrans($Form1, "", 200)
                Case 3
                    WinSetTrans($Form1, "", 150)
                Case 4
                    WinSetTrans($Form1, "", 100)
                Case 5
                    WinSetTrans($Form1, "", 50)
                Case 6
                    WinSetTrans($Form1, "", 0)
            EndSwitch
    EndSwitch
WEnd
GuiDelete($form2)
EndFunc

thanks

Link to comment
Share on other sites

  • Developers

#Tidy_Parameters=/rel 1
#include <GUIConstants.au3>
$Form1 = GUICreate("test", 500, 541)
$transparency = GUICtrlCreateButton("Set Transparency", 80, 515, 95, 25, 0)
GUISetState(@SW_SHOW)
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $transparency
            transparency()
    EndSwitch
WEnd
Func transparency()
    $Form2 = GUICreate("Set transparency.", 345, 80, 191, 109)
    $Slider1 = GUICtrlCreateSlider(32, 32, 281, 41)
    $Label1 = GUICtrlCreateLabel("Move the Slider Across the bar to make the window more transparent", 8, 8, 329, 17)
    GUISetState(@SW_SHOW,$Form2)
    GUICtrlSetLimit($Slider1, 5, 1)
    While 1
        $Msg = GUIGetMsg($Form2)
        Switch $Msg
            Case $GUI_EVENT_CLOSE
                GUIDelete($Form2)
                ExitLoop
            Case $Slider1
                $TransLevel = GUICtrlRead($Slider1)
                Switch $TransLevel
                    Case 1
                        WinSetTrans($Form1, "", 255)
                    Case 2
                        WinSetTrans($Form1, "", 200)
                    Case 3
                        WinSetTrans($Form1, "", 150)
                    Case 4
                        WinSetTrans($Form1, "", 100)
                    Case 5
                        WinSetTrans($Form1, "", 50)
                    Case 6
                        WinSetTrans($Form1, "", 0)
                EndSwitch
        EndSwitch
    WEnd
EndFunc  ;==>transparency

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

JdeB beat me to it :)

And I always forget about GUISwitch, tnx Josbe

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...