Jump to content

GUI Closing too earlt


 Share

Recommended Posts

Can someone point out where I can stuck my $GUI_EVENT_CLOSE in without the GUI closing straight away ?

$filefolder = 'd:\temp'
$fileextension = '*.eml'
Global $Label = 0, $lastlabel = ""
$Gui = GUICreate("Web-DMZ Count", 200, 50)
GUISetBkColor(0xFFFF00)
GUISetState()
$Label = GUICtrlCreateLabel("Jobs:          0", 20, 20)

If $GUI_EVENT_CLOSE Then
    Exit
    EndIf

While 1
    $FileList = _FileListToArray($filefolder, $fileextension);only list files with given extension
    If $FileList <> 0 Then
        If $FileList[0] <> $lastlabel Then
            GUICtrlSetData($Label, "Jobs: " &  $FileList[0])
            $lastlabel = $FileList[0]
        EndIf
    Else
        If $lastlabel <> 0 Then
            GUICtrlSetData($Label, "Clear")
            $lastlabel = 0
            Else
        EndIf
    EndIf
WEnd
Link to comment
Share on other sites

This is such a basic function I think you need to go through the tutorials to learn some of the basics of creating GUIs.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

This is such a basic function I think you need to go through the tutorials to learn some of the basics of creating GUIs.

Well I don't script every day so find this type of thing a struggle sometimes - maybe if I did I would not ask the question to start with. Thanks for NOT helping me.

Link to comment
Share on other sites

I put a link to where you need to go to learn how to do these things, if that's not helping you, then you're on your own. Being willing to make the effort to learn something rather than being handed it goes a long way with me, you're obviously not willing to do even that much.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I put a link to where you need to go to learn how to do these things, if that's not helping you, then you're on your own. Being willing to make the effort to learn something rather than being handed it goes a long way with me, you're obviously not willing to do even that much.

Being willing to learn something new is always on the top of my agenda, I would not have started using Autoit otherwise - it's just I'm stuck on this and want to get this finished asap - and yes I've tried sticking it in the existing loop and looked at other code of mine which has worked in the past but I'm still stuck so obviously doing something wrong. Like I said - thanks for NOT helping me. Anyone can just point people to tutorials no matter what they ask.

Link to comment
Share on other sites

  • Moderators

MattX,

I am with BrewManNH on this one - that is such a basic question that you do not deserve to be given the answer on a plate. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. :)

Try reading this page of the Help file to see what you should be doing to trap the closure event. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

MattX,

I am with BrewManNH on this one - that is such a basic question that you do not deserve to be given the answer on a plate. Think of the old saying: "Give a man a fish, you feed him for a day; give a man a net and you feed him forever". We try to be net makers and repairers, not fishmongers. :)

Try reading this page of the Help file to see what you should be doing to trap the closure event. ;)

M23

Thanks - your much more polite posting helped and I've now solved it.

Link to comment
Share on other sites

Considering most of the code in the While loop is code that Jos and I gave you less than a week ago, I think I can honestly say I've helped enough already. Especially when you chose to ignore everything I told you in your other thread until it was repeated ad nauseum to you about how to keep your label from flickering.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

  • Moderators

MattX,

It was not "more polite", just a little more focused. ;)

I was serious about the "such a basic question" remark - you do not want to make too many requests like that or people will begin to ignore you. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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