Jump to content
Sign in to follow this  

_GUICtrlEdit_AppendText with rollover

Recommended Posts



As you know _GUICtrlEdit_AppendText is limited to the length of the Edit control.
For my need, I modifiied _GUICtrlEdit_AppendText to allow rollover and keep adding news lines removing previous ones.
I am using it to display logging traces of a running program.

Hope it helps some of us

Func _GUICtrlEdit_AppendText_Rollover($hWnd, $sText)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    Local $iLength = _GUICtrlEdit_GetTextLen($hWnd)
    Local $iLengthStr = StringLen($sText)

    if $iLength + $iLengthStr > _GUICtrlEdit_GetLimitText ($hwnd) Then
        ;remove a piece of edit
        _GUICtrlEdit_SetSel($hWnd, 0, $iLengthStr)
        _GUICtrlEdit_ReplaceSel ( $hWnd, "",False)
    _GUICtrlEdit_SetSel($hWnd, $iLength, $iLength)
    _SendMessage($hWnd, $EM_REPLACESEL, True, $sText, 0, "wparam", "wstr")

EndFunc   ;==>_GUICtrlEdit_AppendText_Rollover


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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.