Jump to content
Sign in to follow this  
JohnOne

Help with logic [Solved]

Recommended Posts

JohnOne

I was looking for some scrolling test function, but could not find exactly what I needed, so attemped to make my own.

I want to use it just as a sort of log of my running code or live log if you will.

Its suposed to just add the log item ($Newdata) to the bottom of the gui and scroll it up as it revieves newdata.

My problem is that there is two duplicate lines at the bottom, and I cant get why?

Here is my code

#include <Guiconstants.au3>

Global $aGuiData[20]
Global $Gui
Global $Newdata

Func _GuiCreate(ByRef $aGuiData)
    $Gui = GUICreate("Test", 400, 400, 500, 100)
    Local $a = 0
    For $i = 5 To 290 Step 15
        $aGuiData[$a] = GUICtrlCreateLabel($a, 5, $i, 390, 20)
        $a += 1
    Next

    GUISetState()
EndFunc   ;==>_GuiCreate

Func _UpdateGui($Newdata)
    Local $temp
    For $i = 0 To 18
        $temp = GUICtrlRead($aGuiData[$i + 1])
        GUICtrlSetData($aGuiData[$i], $temp)
        GUICtrlSetData($aGuiData[19], $Newdata)
    Next
EndFunc   ;==>_UpdateGui

_GuiCreate($aGuiData)
For $i = 20 To 100
    Sleep(200)
    _UpdateGui($i)
Next

While 1
    Sleep(50)
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

Its crappy looking too, so if someone can point me toward a better approach I would appreciate it.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Jos

Update this func:

Func _UpdateGui($Newdata)
    Local $temp
    For $i = 0 To 18
        $temp = GUICtrlRead($aGuiData[$i + 1])
        GUICtrlSetData($aGuiData[$i], $temp)
    Next
    GUICtrlSetData($aGuiData[19], $Newdata)
EndFunc   ;==>_UpdateGui

You were updating the last entry before it was moved up

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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  

×