fi3ldy Posted October 21, 2007 Share Posted October 21, 2007 I have another frustrating problem, and are hoping one of you clever guys have a solution! I have a Readyonly Editbox, and I would like it to automatically scroll to the bottom of the box as text is added, so that it always keeps up to date with the recent text added. Heres my code for the box.. Global $log_show = GUICtrlCreateEdit($log_content, 8, 75, 264, 153, BitOR($ES_READONLY,$ES_WANTRETURN,$ES_AUTOVSCROLL), 0) I was wondering if there is anything wrong with that? Or infact if it should work the way I am hoping. Any advice would be much appreciated, thanks guys. Link to comment Share on other sites More sharing options...
smashly Posted October 22, 2007 Share Posted October 22, 2007 Hi, not sure if it's the right way , but here goes..#include <GUIConstants.au3> #Include <GuiEdit.au3> $Gui = GUICreate(";-)", 280, 178, -1, -1) $log_show = GUICtrlCreateEdit("", 8, 8, 264, 153, BitOR($ES_READONLY, $WS_VSCROLL, $ES_MULTILINE), 0) GUISetState(@SW_SHOW, $Gui) WriteData() While 1 $msg = GUIGetMsg() Select Case $msg = -3 Exit EndSelect Wend Func WriteData() For $i = 1 To 40 GUICtrlSetData($log_show, GUICtrlRead($log_show) & @CRLF & "Line " & $i) _GUICtrlEditLineScroll($log_show, 0, $i) Sleep(250) Next EndFunc Cheers Link to comment Share on other sites More sharing options...
fi3ldy Posted October 22, 2007 Author Share Posted October 22, 2007 Thanks I'll give it a go whem I'm home, damn work! Link to comment Share on other sites More sharing options...
GaryFrost Posted October 22, 2007 Share Posted October 22, 2007 (edited) Extract from Beta Example: expandcollapse popup#include <GuiConstants.au3> #include <GuiEdit.au3> #include <GuiStatusBar.au3> Opt('MustDeclareVars', 1) $Debug_Ed = False ; Check ClassName being passed to Edit functions, set to True and use a handle to another control to see it work Global $hEdit _Example_Internal() Func _Example_Internal() Local $hGUI, $StatusBar, $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\include\changelog.txt" Local $aPartRightSide[2] = [378, -1] ; Create GUI $hGUI = GUICreate("(Internal) Edit Line Scroll", 400, 300) $hEdit = GUICtrlCreateEdit("", 2, 2, 394, 268, BitOR($ES_WANTRETURN, $WS_VSCROLL, $ES_READONLY)) $StatusBar = _GUICtrlStatusBar_Create ($hGUI, $aPartRightSide) _GUICtrlStatusBar_SetIcon ($StatusBar, 1, 97, "shell32.dll") GUISetState() ; Set Margins _GUICtrlEdit_SetMargins ($hEdit, BitOR($EC_LEFTMARGIN, $EC_RIGHTMARGIN), 10, 10) ; Set Text _GUICtrlEdit_SetText ($hEdit, FileRead($sFile)) ; Scroll _GUICtrlStatusBar_SetText ($StatusBar, "Scrolled: " & _GUICtrlEdit_LineScroll ($hEdit, 0, _GUICtrlEdit_GetLineCount ($hEdit))) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>_Example_Internal Edited October 22, 2007 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
fi3ldy Posted October 23, 2007 Author Share Posted October 23, 2007 I used the first method, made more sence to me and seemed simpler to understand, worked like a dream, thanks alot! Link to comment Share on other sites More sharing options...
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