Jump to content

GUI won't doesn't respond on close


Recommended Posts

hello there!

I make a script which first creates a GUI and then closes it...then open another GUI and I use exactly the same method to close that GUI but it doesn't respond while closing by the "X" or my "Cancle" button..

here's the script for these two gui's:

$width = 200
$height = 100
$win = GUICreate("Stäng av datorn",$width,$height,@DesktopWidth/2-$width/2,@DesktopHeight/2-$height/2)
GUICtrlCreateLabel("Skriv in när datorn ska stängas av (min):",5,10,200,20)
$min = GUICtrlCreateInput("",5,30,180,20,$ES_NUMBER)
$OK = GUICtrlCreateButton("OK",5,60,80,20)
$Cancle = GUICtrlCreateButton("Avbryt",95,60,80,20)
GUISetState(@SW_SHOW)

While true
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $Cancle Then
        $del = GUIDelete($win)
        Exit
    ElseIf $msg = $OK Then
        $min = GUICtrlRead($min)
        $del = GUIDelete($win)
        ExitLoop
    EndIf
WEnd


.
.
.




GUICreate("Tid kvar",$width,$height,@DesktopWidth/2-$width/2,@DesktopHeight/2-$height/2)
$Can = GUICtrlCreateButton("Avbryt",95,60,80,20)
GUISetState(@SW_SHOW)

While true
        $me= GUIGetMsg()
        If $me = $GUI_EVENT_CLOSE Or $me = $Can Then
            ExitLoop
        EndIf
.
.
.

thankfull for answers!

michcio

Link to comment
Share on other sites

hello there!

I make a script which first creates a GUI and then closes it...then open another GUI and I use exactly the same method to close that GUI but it doesn't respond while closing by the "X" or my "Cancle" button..

here's the script for these two gui's:

$width = 200
   $height = 100
   $win = GUICreate("Stäng av datorn",$width,$height,@DesktopWidth/2-$width/2,@DesktopHeight/2-$height/2)
   GUICtrlCreateLabel("Skriv in när datorn ska stängas av (min):",5,10,200,20)
   $min = GUICtrlCreateInput("",5,30,180,20,$ES_NUMBER)
   $OK = GUICtrlCreateButton("OK",5,60,80,20)
   $Cancle = GUICtrlCreateButton("Avbryt",95,60,80,20)
   GUISetState(@SW_SHOW)
   
   While true
       $msg = GUIGetMsg()
       If $msg = $GUI_EVENT_CLOSE Or $msg = $Cancle Then
           $del = GUIDelete($win)
           Exit
       ElseIf $msg = $OK Then
           $min = GUICtrlRead($min)
           $del = GUIDelete($win)
           ExitLoop
       EndIf
   WEnd
   
   
   .
   .
   .
   
   
   
   
   GUICreate("Tid kvar",$width,$height,@DesktopWidth/2-$width/2,@DesktopHeight/2-$height/2)
   $Can = GUICtrlCreateButton("Avbryt",95,60,80,20)
   GUISetState(@SW_SHOW)
   
   While true
           $me= GUIGetMsg()
           If $me = $GUI_EVENT_CLOSE Or $me = $Can Then
               ExitLoop
           EndIf
   .
   .
   .

thankfull for answers!

michcio

Works ok for me. I can close the second gui with either the button or the red Gui close button. (After I add the missing Wend, missing #includes and remove the dots that is, so it would hav ebeen easier if you had posted a script we could run :) )
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

The entire code you posted has errors and won't run. How can we help you find the problem you stated if you script is full of errors?

8)

yeah I know I have only posted a part of it ... but solved my problem now ... the thing was that I paused the second while loop 1 sec every time and the GUI needs to be updated really fast all the time.

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...