MrNymous Posted May 1, 2010 Posted May 1, 2010 (edited) Please delete this Topic. Edited October 16, 2013 by MrNymous
Moderators Melba23 Posted May 1, 2010 Moderators Posted May 1, 2010 SvenMawby,Use GUIGetMsg with the "advanced" parameter so that you can tell the GUI from which you are receiving the $GUI_EVENT_CLOSE message. Then you can either Exit the whole script or GUIDelete the second GUI. M23 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
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 SvenMawby,Saying "please" ususally works: expandcollapse popup#include <GUIConstantsEx.au3> Global $hNewGUI = 9999 $hGUI = GUICreate("Test", 500, 500) $hButton = GUICtrlCreateButton("New GUI", 10, 10, 80, 30) GUISetState() While 1 ; Note you get an array returned $aMsg = GUIGetMsg(1) ; Which GUI? Switch $aMsg[1] Case $hGUI ; Which control on the GUI? Switch $aMsg[0] Case $GUI_EVENT_CLOSE Exit Case $hButton GUICtrlSetState($hButton, $GUI_DISABLE) $hNewGUI = GUICreate("New GUI", 300, 300) $hNewButton = GUICtrlCreateButton("New Button", 10, 10, 80, 30) GUISetState() EndSwitch Case $hNewGUI ; Which control on the GUI? Switch $aMsg[0] Case $GUI_EVENT_CLOSE GUIDelete($hNewGUI) GUICtrlSetState($hButton, $GUI_ENABLE) Case $hNewButton MsgBox(0, "Hi", "I am on the New GUI") EndSwitch EndSwitch WEndM23 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
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 SvenMawby,If you want help, a few tips: 1. Ask a proper question - "a'm worried" gives absolutely no clue as to what we are supposed to be helping you with. 2. Post code which does not come up with umpteen errors and warnings. If you have this line in your script:#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6to highlight those errors, then correct what it shows you is wrong BEFORE you post the script. We will help with major problems, but you should be able to deal with these minor errors yourself. 3. Try and get your code into a reasonable format. Scripts with large areas of white space and indentation all over the place do not help debugging. If you have the full SciTE4AutoIt3 package (which you can download from here) then you will find a very helpful utility called Tidy in the <Tools> menu which does a good job for you. When you have a script which will not take us a considerable time to sort out BEFORE we can even begin to see what else might be wrong with it, try posting again. M23 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
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 (edited) SvenMawby, i dont knew that there was a new version of autoitIt is not a new version of AutoIt, it is a bigger, better version of the editor SciTE. The normal install only gives you a cut-down version of the editor - the link will let you install the full version. As to your problem, here is the code which creates your main GUI and part of your GUIGetMsg loop: ;main gui $gui = GUICreate("BAM Launcher " & $version, 700, 500, 170, -1, $WS_BORDER) ;$background = GUICtrlCreatePic("bg.bmp", 0, 0, 700, 500, 0) GUISetBkColor(0) $button1 = GUICtrlCreateButton("button", 5, 100, 300, 40, $BS_BITMAP) GUICtrlSetImage($button1, "button.bmp") $button2 = GUICtrlCreateButton("Forum", 5, 150, 300, 40) $button3 = GUICtrlCreateButton("Server", 5, 200, 300, 40) $button4 = GUICtrlCreateButton("Downloads", 5, 250, 300, 40) ;/main gui ; ---------- $aMsg = GUIGetMsg(1) ; Which GUI? Switch $aMsg[1] Case $gui ; Which control on the GUI? Switch $aMsg[0] Case $GUI_EVENT_CLOSE Or $cancelbutton Exit You ask the loop to look out for $cancelbutton - but you have not created a control of that name in the GUI. And so you get an error. M23 Edit: And the correct syntax would anyway be: Case $GUI_EVENT_CLOSE, $cancelbutton Edited May 2, 2010 by Melba23 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
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 (edited) SvenMawby,You cannot give controls on different GUIs the same name - otherwise you keep overwriting the variable and only the last-created is ever actioned.You also need to declare the other GUI names as Global variables at the start of your script or you will get "undeclared" errors when the Switch structure looks for them.Take a look at this: <snip>Top Tip: get the GUI part of your script sorted BEFORE you start adding anything else. Otherwise the script get cluttered and it is hard to see what is going on. M23 Edited October 16, 2013 by Melba23 Code removed at OP's request 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
Moderators Melba23 Posted May 2, 2010 Moderators Posted May 2, 2010 SvenMawby,Global $dl = 9999, $srv = 9999You must declare the variables as I explained, but if you leave them without a value, they fire every time you go through the loop. So you must give them a dummy value that is unlikely to be used (or are you going to have more than 10000 controls in your GUI? )Looking at your images, I imagine the graphic artefacts are there because you have resized your image. Images always look best if you display them at their original size. M23 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
Moderators Melba23 Posted October 16, 2013 Moderators Posted October 16, 2013 MrNymous,I am not at all amused by your actions in this thread. A simple PM asking me to remove any sensitive data would have sufficed rather than just deleting all your posts and so ruining the thread for anyone else who might have been interested in the general topic. If you do such a thing again sanctions will follow. M23 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
Recommended Posts