iagman Posted March 20, 2009 Share Posted March 20, 2009 I discovered AutoIt a couple days ago. I know how to script XML but not AutoIt. But, by copying code and hacking away until it works I've finally gotten a little stock calculator with input windows, output windows, and Calculate, Clear, and Cancel buttons. It works well except still have an elusive round-down problem with one of the calculations. What I've not been able to figure out is how to click on the X at top, right of dialog box and close the application. My Cancel button works ok when clicked which is what I now use. Also, the Minimize button works, but not the X. I tried reading values of the X button with the AutoIt3 Info tool but it doesn't really give me any information as it does for my own controls. How do I connect up this X control so I have two ways of exiting the calculator? Thanks, iagman Link to comment Share on other sites More sharing options...
DaRam Posted March 20, 2009 Share Posted March 20, 2009 (edited) If by X button you mean the GUI Close button on the top right of the Window Titlebar, then#include <GUIConstants.au3> ; Your GUI and button definitions... While 1 $msg = GUIGetMsg() ; Switch $msg Case $GUI_EVENT_CLOSE, $ButtonCancel ; <- Change $ButtonCancel to what your Cancel Button is defined as ExitLoop ;Case $ButtonAdd ; Code for other buttons ;Case $ButtonSubtract EndSwitch Wend ExitEdit: Added #include <GUIConstants.au3> Edited March 20, 2009 by DaRam Link to comment Share on other sites More sharing options...
iagman Posted March 21, 2009 Author Share Posted March 21, 2009 Thanks, got it working. The $GUI_EVENT_CLOSE was what I needed. I'm still foggy about all the commands and not sure how and when they get applied. This is how I added it into my code; Case $msg = $GUI_EVENT_CLOSE Or $msg = $CancelButton There may be a more efficient way to write it, but for now I have to fall back on constructing code the way I know. iagman Link to comment Share on other sites More sharing options...
DaRam Posted March 23, 2009 Share Posted March 23, 2009 I don't know about efficient, but this is simpler: Case $GUI_EVENT_CLOSE, $CancelButton Thanks, got it working. The $GUI_EVENT_CLOSE was what I needed. I'm still foggy about all the commands and not sure how and when they get applied. This is how I added it into my code; Case $msg = $GUI_EVENT_CLOSE Or $msg = $CancelButton There may be a more efficient way to write it, but for now I have to fall back on constructing code the way I know. iagman Link to comment Share on other sites More sharing options...
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