747Skipper Posted August 16, 2014 Posted August 16, 2014 I apologise for asking such a silly question but I don't know the right name to search for! I have written many Autoit scripts and love it but whilst normally any window I create will close if I click the little red cross top right, (What is it's name???) I now have a program which won't. A button for the purpose on the screen works fine, but the little red cross doesn't. Please can someone put me out of my misery? The relevant bits of my code are: Opt("GUIOnEventMode", 1) GUICtrlSetOnEvent($iBtnCloseWindow, "btnClosewindow") While 1 Sleep(200) WEnd various code to achieve my desire end. func BtnClosewindow() Exit EndFunc And this which may just be a hangover from a previous program ( like most programmers I cut and paste the last prog I wrote to start a new one!) Func BtnClose() Exit EndFunc Many thanks in advance and a BIG thank you to all those who wrote and maintain this great program.
Moderators Solution Melba23 Posted August 16, 2014 Moderators Solution Posted August 16, 2014 747Skipper,Welcome to the AutoIt forum. Add this after creating the GUI:GUISetOnEvent($GUI_EVENT_CLOSE, "btnClosewindow")Now you will detect the [X] event and fire the same function as your "Close" button. And when you post code please use Code tags - see here how to do it. M23P.S. And if you are really what your nick says - a special welcome from one aviator to another. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
747Skipper Posted August 16, 2014 Author Posted August 16, 2014 Thanks Melba23, I knew there had to be a simple answer, although I still don't know what [X] is called! Sorry about not following standards, I'll do better next time. Yes 30 years behind the yoke man and boy, starting on Tridents then all the 100, 200 and 400 Queen of the Skies. Pensioned off 10 years ago and I was that! close to knowing how to do it. Still I got to be series consultant to Cabin Pressure. Thanks again, Happy landings
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now