ray306 Posted February 9, 2007 Posted February 9, 2007 Hi all, I have a question about the evident lag I am experiencing when clicking a button on a GUI. The response time must be .5 sec or so which may not seem like a lot but if you repeatedly click a button it will miss some of the clicks. I have tried lowering the thresholds on the following: OPt(MouseClickDelay) Opt(MouseClickDownDelay) Opt(WinWaitDelay) I have also tried to lower the Sleep time in the while loop (it is in onEvent mode) I also notice that when I give the button focus(ie click on it) I can then use the enter to repeatedly hot the button and I experience virtually no lag. The response time is great. Hope someone can enlighten me Thanks Ray
PaulIA Posted February 10, 2007 Posted February 10, 2007 Hi all,I have a question about the evident lag I am experiencing when clicking a button on a GUI.The response time must be .5 sec or so which may not seem like a lot but if you repeatedly click a buttonit will miss some of the clicks.I have tried lowering the thresholds on the following: OPt(MouseClickDelay) Opt(MouseClickDownDelay) Opt(WinWaitDelay)I have also tried to lower the Sleep time in the while loop (it is in onEvent mode)I also notice that when I give the button focus(ie click on it) I can then use the enter to repeatedly hot the buttonand I experience virtually no lag. The response time is great.Hope someone can enlighten meThanksRayCan you post a small piece of code that shows the problem? Auto3Lib: A library of over 1200 functions for AutoIt
ray306 Posted February 10, 2007 Author Posted February 10, 2007 Thanks for the response Can you post a small piece of code that shows the problem? This application loads a database query into a 2 dimensional array called DataArray[][] The next button that lags is to go to the next record. Here is the event handler and the subFunction it calls CODEFunc NextClick() If $placeholder < $highIndex Then;increments counter $placeholder = $placeholder + 1 Else $placeholder = 1;takes care of wrap around EndIf populate($placeholder); puts data into all the controls If GUICtrlRead ($Study) = $GUI_CHECKED And GUICtrlRead ($Hide) = $GUI_CHECKED then HideData() Endif EndFunc Func populate($a) If $highIndex <1 Then MsgBox(1,@ScriptLineNumber&"Data Error","It would appear that there is no data with which to populate the form."&@cr& _ "This normally occurs when you try to acess a Group that has no files as yet."&@cr& _ "Please check to see in an empty group has been selected.") return EndIf GUICtrlSetData ( $Name, $DataArray[$a][1]) GUICtrlSetData ( $Family, $DataArray[$a][3]) GUICtrlSetData ( $Order, $DataArray[$a][4]) GUICtrlSetData ( $Habitat, $DataArray[$a][5]) $z = StringSplit ( $DataArray[$a][7], "" ) ;MsgBox(1,@ScriptLineNumber,"Identifier"&$DataArray[$a][7]);DEBUG If $z[0] ="" or $z[0] =0 Then GUICtrlSetImage ( $Picture, "C:\NoImage.jpg" ) Else GUICtrlSetImage ( $Picture, $DataArray[$a][7]) Endif GUICtrlSetData ( $RecNum2, "Rec: "& $DataArray[$a][0]) EndFunc Thanksfor your help Ray
Valuater Posted February 10, 2007 Posted February 10, 2007 (edited) First, I like your approach to this... 8) Maybe... expandcollapse popup; just ideas here ; If you use the "hide data" variable, things can move much faster ; if you use fileexists, that might help also Dim $Hide_data Func NextClick() If $placeholder < $highIndex Then;increments counter $placeholder = $placeholder + 1 Else $placeholder = 1;takes care of wrap around EndIf If GUICtrlRead($Study) = $GUI_CHECKED And GUICtrlRead($Hide) = $GUI_CHECKED Then If $Hide_data = 1 Then Return HideData () $Hide_data = 1 Else populate($placeholder); puts data into all the controls EndIf EndFunc ;==>NextClick Func populate($a) If $highIndex < 1 Then MsgBox(1, @ScriptLineNumber & "Data Error", "It would appear that there is no data with which to populate the form." & @CR & _ "This normally occurs when you try to acess a Group that has no files as yet." & @CR & _ "Please check to see in an empty group has been selected.") Return EndIf GUICtrlSetData($Name, $DataArray[$a][1]) GUICtrlSetData($Family, $DataArray[$a][3]) GUICtrlSetData($Order, $DataArray[$a][4]) GUICtrlSetData($Habitat, $DataArray[$a][5]) If FileExists($DataArray[$a][7]) Then GUICtrlSetImage($Picture, $DataArray[$a][7]) Else GUICtrlSetImage($Picture, "C:\NoImage.jpg") EndIf GUICtrlSetData($RecNum2, "Rec: " & $DataArray[$a][0]) EndFunc ;==>populate 8) Edited February 10, 2007 by Valuater
ray306 Posted February 10, 2007 Author Posted February 10, 2007 Thanks for your input valuator Just a note( I should have included it or at least alluded to it. The Hidedata() function is responsible for not showing(hiding) the data based upon the values in the radio buttons(checked or unchecked). Your approach is valid and I can see how I can remove 1 line ofvalue checking by using it. I still experience the lag though, but only when I try to click the "Next" button. When I click the "Next" button (giving the button focus) I can then hit the "Enter" key as fastas I want; no lag. Since it would appear that the problem has something to do with how the button processes the actual click. By hitting "Enter" it would appear that the event notifier bypasses the settings on the buttonclick event notifier. I already tried lowering the threshold settings on teh mouse; just trying to understand. Thanks Ray First, I like your approach to this... 8) Maybe... expandcollapse popup; just ideas here ; If you use the "hide data" variable, things can move much faster ; if you use fileexists, that might help also Dim $Hide_data Func NextClick() If $placeholder < $highIndex Then;increments counter $placeholder = $placeholder + 1 Else $placeholder = 1;takes care of wrap around EndIf If GUICtrlRead($Study) = $GUI_CHECKED And GUICtrlRead($Hide) = $GUI_CHECKED Then If $Hide_data = 1 Then Return HideData () $Hide_data = 1 Else populate($placeholder); puts data into all the controls EndIf EndFunc ;==>NextClick Func populate($a) If $highIndex < 1 Then MsgBox(1, @ScriptLineNumber & "Data Error", "It would appear that there is no data with which to populate the form." & @CR & _ "This normally occurs when you try to acess a Group that has no files as yet." & @CR & _ "Please check to see in an empty group has been selected.") Return EndIf GUICtrlSetData($Name, $DataArray[$a][1]) GUICtrlSetData($Family, $DataArray[$a][3]) GUICtrlSetData($Order, $DataArray[$a][4]) GUICtrlSetData($Habitat, $DataArray[$a][5]) If FileExists($DataArray[$a][7]) Then GUICtrlSetImage($Picture, $DataArray[$a][7]) Else GUICtrlSetImage($Picture, "C:\NoImage.jpg") EndIf GUICtrlSetData($RecNum2, "Rec: " & $DataArray[$a][0]) EndFunc ;==>populate 8)
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