Jump to content
Sign in to follow this  
747Skipper

Close window with red cross

Recommended Posts

747Skipper

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.

Share this post


Link to post
Share on other sites
Melba23

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

M23

P.S. And if you are really what your nick says - a special welcome from one aviator to another. :thumbsup:


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

 

Share this post


Link to post
Share on other sites
747Skipper

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

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  

×