Sign in to follow this  
Followers 0
michcio

GUI won't doesn't respond on close

6 posts in this topic

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

Share this post


Link to post
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)


NEWHeader1.png

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

u dont need to do @DesktopWidth/2-$width/2 etc... just put ''-1'' as the helpfile says

Share this post


Link to post
Share on other sites

u dont need to do @DesktopWidth/2-$width/2 etc... just put ''-1'' as the helpfile says

ah nice missed that in the helpfile..thanks :)

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  
Followers 0