ripdad Posted March 30, 2020 Share Posted March 30, 2020 (edited) While recently working on a project, I ran into this issue. Can anyone confirm this? Local $ID_GUI = GUICreate('GUIOnEventMode Test', 400, 400) Local $ID_Open = GUICtrlCreateButton('Open', 290, 350, 80, 20) GUICtrlSetOnEvent($ID_Open, '_GUI_CtrlMgr') GUISetOnEvent(-3, '_GUI_CtrlMgr') GUISetState(@SW_SHOW, $ID_GUI) Opt('GUIOnEventMode', 1) Local $n = 0 ; While 1 Sleep(1000) WEnd ; Func _GUI_CtrlMgr() ; Opt('GUIOnEventMode', 0); disable events ; Switch @GUI_CtrlId Case $ID_Open ; Click GUI button 5 to 10 times while FileOpenDialog is visible and then release. ; Cancel the FileOpenDialog's and Watch the ToolTip. Local $sFile = FileOpenDialog('Select File', '', 'Text Files (*.txt)') $n += 1 ToolTip('Number of Events: ' & $n, 0, 0) Case -3 ToolTip('') Exit Case Else EndSwitch ; Opt('GUIOnEventMode', 1); enable events ; EndFunc Edit: I commented out the Opt('GUIOnEventMode', 1) at the end of the function, and it Will Disable Events. So, it must be something in the core code of AutoIt holding the events in memory, even though events are disabled. I even tried it going back to v3.3.6.0 -- same thing. Edited March 31, 2020 by ripdad "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
ripdad Posted March 31, 2020 Author Share Posted March 31, 2020 I found a solution. Just disable it from the source, then re-enable after the code runs: GUICtrlSetOnEvent($ID_Open, ''); disable event ; working code goes here GUICtrlSetOnEvent($ID_Open, '_GUI_CtrlMgr'); enable event "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
ripdad Posted March 31, 2020 Author Share Posted March 31, 2020 By the way that GUICtrlSetOnEvent behaves, I believe the wording should be renamed from: enable to start and disable to pause Otherwise, one would have the wrong impression about the behavior of the function. Just my opinion... "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
ripdad Posted March 31, 2020 Author Share Posted March 31, 2020 So, there has been an issue with events between AutoIt versions starting after v3.3.8.1 GUICtrlSetOnEvent($ID_Open, '') behaves the same way that Opt('GUIOnEventMode', 0) does. Tested versions: AutoIt v3.3.10.0 through AutoIt v3.3.15.0 Which leaves me with the 3rd option: GUICtrlSetState($ID_Open, $GUI_DISABLE) ; working code goes here GUICtrlSetState($ID_Open, $GUI_ENABLE) So far, that seems to be working out great, since the button itself is disabled. "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 31, 2020 Moderators Share Posted March 31, 2020 ripdad, Sorry, only just noticed this thread. This problem should be fixed in the next release. 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 Link to comment Share on other sites More sharing options...
ripdad Posted March 31, 2020 Author Share Posted March 31, 2020 Melba23, Very good, thank-you! "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward 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