ReallyMute Posted September 1, 2008 Share Posted September 1, 2008 (edited) Hello, I constructed a set of GUIControls to send text over to a window with different options. The GUI list, slider and button I'm using seem to stubbornly refuse to respond to mouse clicks sometimes... as if the click events were being 'lost'. I find myself earnestly clicking 2, 3 times (not double-clicks) on the same control to get some reaction. Is this a product of my coding or are AutoIt GUI controls (and the message polling loop) unreliable and unable to robustly deal with mouse input? Code Extract : While GuiGetMsg() <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() if $commandfinished and $buttonstatechanged then GUICtrlSetState($Button_1, $GUI_ENABLE) $buttonstatechanged = false EndIf Select Case $msg == $GUI_EVENT_CLOSE ExitLoop Case $msg == $Button_1 if $commandfinished then GUICtrlSetState($Button_1, $GUI_DISABLE) $buttonstatechanged = false ;displayNotepad() ; Will Run/Open Notepad ........... (code omitted here ) ..................... WEnd END extract If they are usually reliable, are there tricks to use or traps to avoid? Thanks for your opinionSendRappelzText.au3 Edited September 1, 2008 by ReallyMute Link to comment Share on other sites More sharing options...
martin Posted September 1, 2008 Share Posted September 1, 2008 Hello, I constructed a set of GUIControls to send text over to a window with different options. The GUI list, slider and button I'm using seem to stubbornly refuse to respond to mouse clicks sometimes... as if the click events were being 'lost'. I find myself earnestly clicking 2, 3 times (not double-clicks) on the same control to get some reaction. Is this a product of my coding or are AutoIt GUI controls (and the message polling loop) unreliable and unable to robustly deal with mouse input? Code Extract : While GuiGetMsg() <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() if $commandfinished and $buttonstatechanged then GUICtrlSetState($Button_1, $GUI_ENABLE) $buttonstatechanged = false EndIf Select Case $msg == $GUI_EVENT_CLOSE ExitLoop Case $msg == $Button_1 if $commandfinished then GUICtrlSetState($Button_1, $GUI_DISABLE) $buttonstatechanged = false ;displayNotepad() ; Will Run/Open Notepad ........... (code omitted here ) ..................... WEnd END extract If they are usually reliable, are there tricks to use or traps to avoid? Thanks for your opinionWelcome to AutoIt forums ReallyMute. The main problem with your script is that you are discarding a lot of the events detected which is why you have to click a number of times to get a reaction. While GuiGetMsg() <> $GUI_EVENT_CLOSE;GuiGetMsg() returns the event but nothing is done if the event is not $GUI_EVENT_CLOSE $msg = GUIGetMsg();then GuiGetMsg() returns the next event if there is one but if the last event was $button_1 it has been lost. I hope that makes sense. Since you already have a way to deal with $GUI_EVENT_CLOSE in your select statement then the easiest fix is to replace While GuiGetMsg() <> $GUI_EVENT_CLOSE with While 1 Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ReallyMute Posted September 2, 2008 Author Share Posted September 2, 2008 Welcome to AutoIt forums ReallyMute. The main problem with your script is that you are discarding a lot of the events detected which is why you have to click a number of times to get a reaction. While GuiGetMsg() <> $GUI_EVENT_CLOSE;GuiGetMsg() returns the event but nothing is done if the event is not $GUI_EVENT_CLOSE $msg = GUIGetMsg();then GuiGetMsg() returns the next event if there is one but if the last event was $button_1 it has been lost. I hope that makes sense. Since you already have a way to deal with $GUI_EVENT_CLOSE in your select statement then the easiest fix is to replace While GuiGetMsg() <> $GUI_EVENT_CLOSE with While 1 Thank you , Martin I took that While / Wend loop from one of the examples (SampleControls.au3) provided with AutoIt3. I assumed it was the correct approach. I'll try your advice and be more wary of the samples in the future. - ReallyMute Link to comment Share on other sites More sharing options...
martin Posted September 2, 2008 Share Posted September 2, 2008 Thank you , MartinNPI took that While / Wend loop from one of the examples (SampleControls.au3) provided with AutoIt3. I assumed it was the correct approach.- ReallyMuteI think there is nothing wrong with the SampleControls.au3 example, maybe you misread it. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. 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