Sign in to follow this  
Followers 0
ray306

lag time in Gui buttons

5 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Can you post a small piece of code that shows the problem?

Auto3Lib: A library of over 1200 functions for AutoIt

Share this post


Link to post
Share on other sites

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

CODE
Func 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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

First, I like your approach to this... 8)

Maybe...

; 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 by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

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...

; 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)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0