z0mgItsJohn Posted April 11, 2009 Share Posted April 11, 2009 How to I make it so that when I use GUICtrlSetData () that it dose not effect the scroll position of the edit box.. For example, You have a program with a edit box and in the edit box it shows what the program is downloading.. and it looks kinda like this; Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 100% Test.exe : 78% okay.. so your at the point where the top three lines are not showing but your bottom line still needs to update.. but when you use GUICtrlSetData () to update it, it scrolls back to the top and it dose not show the bottom line(s)... * Iv tried a few different ways to try and update the box and it always has to scroll from top to bottom (really fast) but you notice it.. (witch sucks) if there is not a way to get by this (or) is there a way to edit the last line with out updating the other lines..? hope you can understand my problem... - John Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
Authenticity Posted April 11, 2009 Share Posted April 11, 2009 Dim $hGUI = GUICreate('Test', 300, 300) Dim $Edit = GUICtrlCreateEdit('', 0, 0, 300, 200) Dim $Button = GUICtrlCreateButton('', 115, 230, 70, 23) GUISetState() While 1 Switch GUIGetMsg() Case $Button GUICtrlSetData($Edit, '123' & @CRLF, 1) Case -3 ExitLoop EndSwitch Sleep(20) WEnd GUIDelete() Although unnecessary, you get the point. ;] Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted April 11, 2009 Author Share Posted April 11, 2009 (edited) That dose not help.. I need to to update the last line (not add a new one) w/o scrolling backup... * and the only way to do the "updating percent" is to use a log and update the whole edit.. so is there a way to lock the scroll at its current position, update edit box, unlock... Edited April 11, 2009 by John2006 Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
Authenticity Posted April 11, 2009 Share Posted April 11, 2009 Then maybe a listbox is more suited? Anyway, if you're insisting to do it that way which is fine ;] you can use GUICtrlSendMsg and one of these messages: EM_LINESCROLL EM_SCROLLCARET EM_SCROLL WM_VSCROLL .... Link to comment Share on other sites More sharing options...
z0mgItsJohn Posted April 11, 2009 Author Share Posted April 11, 2009 I'v used the function(s) to make it scroll down after update but it still looks bad because you see it scroll to the top, then back down.. heres an example.. expandcollapse popup#Include <WindowsConstants.Au3> #Include <GUIConstantsEx.Au3> #Include <GUIEdit.Au3> #Include <File.Au3> Opt ('GUIOnEventMode','1') Global $Log = @TempDir & '\Log' If FileExists ($Log) Then FileDelete ($Log) $GUI = GUICreate ('','250','200','-1','-1','-1', $WS_EX_TOOLWINDOW) GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit') $Console = GUICtrlCreateEdit ('','0','0','250','200') GUICtrlSetFont ($Console, '10','','','Lucida Sans Unicode') GUICtrlSetBkColor ($Console, '0x83B4FC') GUICtrlSetColor ($Console, '0xFFFFFF') GUISetState (@SW_SHOW) For $A = '1' To '50' _Log ('Test_' & $A & '.exe : 0%') For $B = '1' To '100' _UpdateLastLine ('Test_' & $A & '.exe : ' & $B & '%') Next Next While '1' Sleep ('150') WEnd Func _Log ($iData) FileWriteLine ($Log, $iData) GUICtrlSetData ($Console, FileRead ($Log)) EndFunc Func _UpdateLastLine ($iData) _FileWriteToLine ($Log, _FileCountLines ($Log), '', '1') FileWriteLine ($Log, $iData) GUICtrlSetData ($Console, FileRead ($Log)) EndFunc Func _Exit () Exit EndFunc when running the above script after the console gets to about "Test_11.exe" you stop seeing the others.. and if you add a "system" to scroll back down it looks bad.. and I don't know if a listbox will suit my needs.. =s (btw : thanks for trying) Latest Projects :- New & Improved TCP Chat Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 11, 2009 Share Posted April 11, 2009 (edited) if you want to Scroll to the top then #Include <GuiEdit.au3> _GUICtrlEdit_Scroll($hWnd,$SB_SCROLLCARET) of an editbox might be what your wanting EDIT edited code ^ Edited April 11, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] 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