Jump to content

$GUI_EVENT_CLOSE - Nothing happens


 Share

Recommended Posts

Hi!

At first I have to say, that I started programming with AutoIt just yesterday and I'm making some fast progress! But right at the Moment I'm running into a bit of a problem.

I'm using Opt("GUIOnEventMode",1) to receive events instead of polling.

I have a main window in which some parameters can be set. And there is a big "Start" button to begin the calculations. When I click on the Close-Button on this main window, the program exits as desired.

By clicking on start, the main window is closed and a function ist called for the calculations. A new window with a prograss bar is displayed. I want to get the $GUI_EVENT_CLOSE from the window with the progress bar but nothing happens. Here's some code:

progress window:

CODE
$progwindow=GUICreate("Fortschritt",200,50)

$progbar=GUICtrlCreateProgress (10,10,180,30)

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked",$progwindow)

GUISetState(@SW_SHOW,$progwindow)

function CLOSEClicked

CODE
Func CLOSEClicked()

if $converting Then

$id=MsgBox(17,"Abbruch","Konvertierung nicht abgeschlossen."&@CR&"Abbrechen und unvollständige Datei löschen?")

if $id=2 then

Return

Else

FileClose($zielhandle)

FileClose($quellhandle)

FileDelete($ziel)

EndIf

EndIf

Exit

EndFunc

BTW I'm also using HotKeySet("^c","CLOSEClicked"). This works while the progress bar is displayed, the program ends in the desired way. When I click on the Close-Button, nothing happens. I am confused, can somebody help me?

Thanx in advance, Jürgen Mayer

Link to comment
Share on other sites

I just checked it again. The Minimize-Button also minimizes the progress window. With Opt("GUIOnEventMode", 1) this should not happen. Instead I should just get an event. It seems that the events are not reaching my script. What have I done wrong?

Link to comment
Share on other sites

I just checked it again. The Minimize-Button also minimizes the progress window. With Opt("GUIOnEventMode", 1) this should not happen. Instead I should just get an event. It seems that the events are not reaching my script. What have I done wrong?

Not sure how you reached that conclusion. Behaviour of minimize button is the same in both GUI modes.

You can change it with Opt("GUIEventOptions",1)

"be smart, drink your wine"

Link to comment
Share on other sites

Not sure how you reached that conclusion. Behaviour of minimize button is the same in both GUI modes.

You can change it with Opt("GUIEventOptions",1)

I thought that setting Opt("GUIOnEventMode",1) would be enough. I just added Opt("GUIEventOptions",1). The window now does not minimize any more. But still, I get no event when I click on the CloseButton.

Link to comment
Share on other sites

Replace $GUI_EVENT_CLOSE with -3, that should do it.

Nope...

But I begin to see what's wrong here. I have a first window. This window has a "Start" button to begin with the calculations. I'm using

GUICtrlSetOnEvent($startbutton,"Main")

to give control to function "Main" when the button is pressed.

Inside this function I want to display the progress bar. And inside this function I want to receive the $GUI_EVENT_CLOSE. The Problem ist - as I know by now - I'm getting this event only after "Main" has ended. How can I receive this event inside the function "Main"?

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