Allow2010 Posted February 25, 2012 Share Posted February 25, 2012 (edited) hi all, i use an edit control to display a logfile. This is update every few seconds and when i load the updated logfile to the edit, the cursor position in the edit is reset...is there an easy way to 1. keep the current curor position/view position or 2. go to the end of the text after it has been loaded? I was thinking about using send to send the end key, but i can not give focus to the edit control every few seconds to do this... ideas are welcome...thanks ! Edited February 25, 2012 by Allow2010 Link to comment Share on other sites More sharing options...
somdcomputerguy Posted February 25, 2012 Share Posted February 25, 2012 You could use ControlSend, then you might not have to give this control focus. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
Allow2010 Posted February 26, 2012 Author Share Posted February 26, 2012 (edited) thanks, will try it... Edit: Local $iLines = _GUICtrlEdit_GetLineCount($hEdit) _GUICtrlEdit_LineScroll($hEdit, 0, $iLines) works like a charm....thanks !! Edited February 26, 2012 by Allow2010 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 26, 2012 Moderators Share Posted February 26, 2012 Allow2010, I would do it like this - the code fired by the button would be used by your update function: #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ScrollBarConstants.au3> $sText = "Line 1" $iCount = 1 $hGUI = GUICreate("Test", 500, 500) $cEdit = GUICtrlCreateEdit($sText, 10, 10, 200, 200) $cButton = GUICtrlCreateButton("Update", 10, 300, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cButton GUICtrlSetState($cEdit, $GUI_FOCUS) $iCount += 1 $sText &= @CRLF & "Line " & $iCount GUICtrlSetData($cEdit, $sText) _GUICtrlEdit_SetSel($cEdit, -1, -1) _GUICtrlEdit_Scroll($cEdit, $SB_SCROLLCARET) EndSwitch WEnd M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Allow2010 Posted February 26, 2012 Author Share Posted February 26, 2012 OK, but this sets focus, which might be a problem...thanks anyway... 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