atzoref Posted February 2, 2012 Share Posted February 2, 2012 (edited) Hi,I have main GUI window which also running a function which open a kind of popup GUI windowThe problem is that on the popup GUI, GUICtrlSetOnEvent not running the specific functionThe button "Cancel" not doing nothing, but the alhought $GUI_EVENT_CLOSE works works goodWhy is that?Here is the code of the popup GUI:Func ItemSettings() $frSettingsWindow = GUICreate("A", 491, 275, -1, -1) $btnApply = GUICtrlCreateButton("Apply", 320, 224, 75, 25) $btnCancel = GUICtrlCreateButton("Cancel", 400, 224, 75, 25) $edNumOfLoops = GUICtrlCreateInput("1", 128, 32, 121, 21) $chbResetScanner = GUICtrlCreateCheckbox("Reset Scanner", 32, 56, 97, 17) $lLoops = GUICtrlCreateLabel("Number Of Loops:", 32, 32, 90, 17) AutoItSetOption("GUIOnEventMode", 1) ;Enable OnEvent functions notifications.ventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "closePopup", $frSettingsWindow) ;GUISetOnEvent($btnApply, "ChangeName", $frSettingsWindow) GUISetOnEvent($btnCancel, "Temp", $frSettingsWindow) GUISetState(@SW_SHOW, $frSettingsWindow) EndFunc Func closePopup() GUIDelete ( @GUI_WinHandle ) EndFunc Func Temp() MsgBox(0,"","TT") EndFunc Edited February 2, 2012 by atzoref Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 2, 2012 Moderators Share Posted February 2, 2012 atzoref,Firstly, learn to set your code out in a more logical way - like putting the Opt to set OnEvent mode at the top. Take a look at the example below. I also suggest that you put the *SetOnEvent lines immediately after the item to which they refer. That way you will find it easier to see the error of using GUISetOnEvent($btnCancel...) rather than GUICtrlSetOnEvent($btnCancel...). This works for me:#include <GUIConstantsEx.au3> AutoItSetOption("GUIOnEventMode", 1) ;Enable OnEvent functions notifications.ventMode", 1) ItemSettings() While 1 Sleep(10) WEnd Func ItemSettings() $frSettingsWindow = GUICreate("A", 491, 275, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "closePopup") $btnApply = GUICtrlCreateButton("Apply", 320, 224, 75, 25) $btnCancel = GUICtrlCreateButton("Cancel", 400, 224, 75, 25) GUICtrlSetOnEvent($btnCancel, "Temp") $edNumOfLoops = GUICtrlCreateInput("1", 128, 32, 121, 21) $chbResetScanner = GUICtrlCreateCheckbox("Reset Scanner", 32, 56, 97, 17) $lLoops = GUICtrlCreateLabel("Number Of Loops:", 32, 32, 90, 17) GUISetState(@SW_SHOW, $frSettingsWindow) EndFunc ;==>ItemSettings Func closePopup() GUIDelete(@GUI_WinHandle) EndFunc ;==>closePopup Func Temp() MsgBox(0, "", "TT") EndFunc ;==>TempM23 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 Link to comment Share on other sites More sharing options...
atzoref Posted February 2, 2012 Author Share Posted February 2, 2012 (edited) Thanks on your help and for your Tips It's OK now Edited February 2, 2012 by atzoref 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