Sign in to follow this  
Followers 0
foster74

How to stop GUICtrlEdit from scrolling on update?

2 posts in this topic

I'm going crazy here =/ I haven't been able to figure out how to stop my EditCtrl from scrolling to the last line when it's updated. What I'm after is if the scroll bar isn't on the bottom when the Control is updated, then for the update to not cause it to auto scroll to last line, but if it is on bottom line when updated, for it to stay there, (e.g., AIM). Pretty much anything to send me near the right direction is what I'm after, I appreciate any and all suggestions, thank you.

#include <GuiEdit.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>

Opt("GUIOnEventMode", 1)
$hGUI = GUICreate("gui", 700, 272)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
$hEdit = GUICtrlCreateEdit ('','2','2','694','268', BitOR($ES_READONLY, $ES_LEFT, $WS_VSCROLL))
GUICtrlSetFont (-1, '10','','','Lucida Sans Unicode')
GUICtrlSetBkColor (-1, '0xFFFFFF')
GUISetState()
_GUICtrlEdit_SetMargins($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 2, 2)
_GUICtrlEdit_SetText($hEdit, '1' & @CRLF & '2' & @CRLF & '3' & @CRLF& '4' & @CRLF& '5' & @CRLF& '6' & @CRLF& '7' & @CRLF& '8' & @CRLF& '9' & @CRLF& '10' & @CRLF& '11' & @CRLF& '12' & @CRLF& '13' & @CRLF& '14' & @CRLF & '15')

For $i = 16 to 1000
    sleep(1500)
    _Write($i)
Next

Func _Write ($Data)
    _GUICtrlEdit_AppendText($hEdit,@CRLF & $Data)
EndFunc

Func CLOSEClicked()
  $answer = msgbox(262148, "Exit", "Are you sure you want to exit?")
    If $answer = 6 Then
        Exit
    EndIf
EndFunc

Share this post


Link to post
Share on other sites



I know it´s not a nice solution

Replace your _Write ($Data)

with the following

Func _Write ($Data)

_GUICtrlEdit_AppendText($hEdit,@CRLF & $Data)

For $i = ($Data - 16) to $Data

_GUICtrlEdit_Scroll($hEdit, $SB_LineUp)

Next

EndFunc

Best regards,

Emiel


Best regards,Emiel Wieldraaijer

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