avery Posted February 5, 2009 Share Posted February 5, 2009 (edited) Does anyone know how to make an Edit control scroll to the bottom on new text. I tried all the combinations I could think of documented here: http://www.autoitscript.com/autoit3/docs/a...x/GUIStyles.htm. Currently the only way I can keep the latest status message at top and viewable to the user is to reverse the lines I write so the new ones stay at the top. This looks pretty silly though. Can someone please help me. $status = GUICtrlCreateEdit("", 8, 104, 609, 169, BitOR($ES_AUTOVSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_VSCROLL)) ... Func _s($line) $_ln += 1 $set_status = GUICtrlRead($status) $line = $line & @CRLF & $set_status ;$line = $set_status & $line GUICtrlSetData($status, "[" & $_ln & "] " & $time & $line & @CRLF) EndFunc ;==>_s Example of my reverse output. I'd like to make the window scroll down on new data and the numbers to be 1, 2, 3, etc not 6, 5, 4, 3 etc. [6] 2009/02/04@22:07:(29) secedit command documented in secedit_cmd.bat [5] 2009/02/04@22:07:(29) _LOGFILE: C:\Program Files\NISP_Utilities\logs\Abox.txt [4] 2009/02/04@22:07:(29) DATABASE: C:\Program Files\NISP_Utilities\config\Abox.sdb [3] 2009/02/04@22:07:(29) TEMPLATE: C:\Program Files\NISP_Utilities\config\Abox.inf [2] 2009/02/04@22:07:(29) Moved template from inf\ to config\ I can post a screen shot or all the code, or email, post / link. Anything. Please. *bangs head here* Edited February 6, 2009 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
enaiman Posted February 5, 2009 Share Posted February 5, 2009 Here you go ... #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 398, 167, 193, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $Edit1 = GUICtrlCreateEdit("", 16, 16, 361, 105) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Button1", 144, 136, 75, 25, 0) GUICtrlSetOnEvent(-1, "Button1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $text = "line " $counter = 0 While 1 Sleep(100) WEnd Func Button1Click() $end_rcv = StringLen(GUICtrlRead($Edit1)) _GUICtrlEdit_SetSel($Edit1, $end_rcv, $end_rcv) _GUICtrlEdit_ReplaceSel($Edit1, $text&$counter&@CRLF, False) $counter +=1 EndFunc Func Form1Close() Exit EndFunc SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
avery Posted February 5, 2009 Author Share Posted February 5, 2009 (edited) Edit: I tried your example and it doesn't work but i am still trying to figure it out toooooooo. But thanks for trying. I'll keep messing with it. Edited February 5, 2009 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
enaiman Posted February 5, 2009 Share Posted February 5, 2009 What doesn't work ?? It does exactly what you want: it scrolls down on new text entered so the new text will always be visible. Please keep in mind: when somebody tries to help you, saying only that "I tried your example and it doesn't work" it's ... hmm ... "not the best answer" you can give. You need usually to say what didn't work and explain (again ...) what are you trying to achieve so the one trying to help you can understand better what your problem is. Saying only "it doesn't work" can be seen as a demanding atitude ... and the help here is "offered" not "requested". Good luck in figuring it out. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
avery Posted February 6, 2009 Author Share Posted February 6, 2009 What doesn't work ?? It does exactly what you want: it scrolls down on new text entered so the new text will always be visible.Please keep in mind: when somebody tries to help you, saying only that "I tried your example and it doesn't work" it's ... hmm ... "not the best answer" you can give. You need usually to say what didn't work and explain (again ...) what are you trying to achieve so the one trying to help you can understand better what your problem is. Saying only "it doesn't work" can be seen as a demanding atitude ... and the help here is "offered" not "requested".Good luck in figuring it out.It's just your help made me even more confused on the topic. I'm still learning and appreciate your time but I think I need to start with some more basic stuff and work my way up or find someone who is willing to help me understand how it works rather then toss out cryptic lines with no explanation. Maybe someone more my level will see my post and be willing to help. Thanks for all your advice on how to make good posts though it was really helpful. www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
enaiman Posted February 6, 2009 Share Posted February 6, 2009 You had only 3 "cryptic lines" ... let's see ... $end_rcv = StringLen(GUICtrlRead($Edit1)) ... the length of the string read from editbox $Edit1 = how many characters are written in the editbox _GUICtrlEdit_SetSel($Edit1, $end_rcv, $end_rcv) ... select "anything" after the last character = place the cursor at the end of the text _GUICtrlEdit_ReplaceSel($Edit1, $text&$counter&@CRLF, False) ... replace that selection with your text hope this explanation makes everything clear to you ... SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
CodyBarrett Posted February 6, 2009 Share Posted February 6, 2009 (edited) wow ummm i am interested i am checking @Enaiman i am checking your script out... BTW have you guys notcied that uhh the only DISpics (besides mine now that i have ruined it) are CATS!!! one animated and one Supposedly real... WOW FREAKY [EDIT] Sorry guys my bad for hijacking topic *Slaps forehead * gotta quit making statements like that Really lol its funny about the cats but yeah sorry..... and uhhh if you want the edit to be at the bottom and if it still didnt work (mine doesnt although it might be a different style) try using _GUICtrlEdit_Scroll Edited February 6, 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...
avery Posted February 6, 2009 Author Share Posted February 6, 2009 (edited) wow ummm i am interested i am checking @Enaiman i am checking your script out... BTW have you guys notcied that uhh the only DISpics (besides mine now that i have ruined it) are CATS!!! one animated and one Supposedly real... WOW FREAKY [EDIT] Sorry guys my bad for hijacking topic *Slaps forehead * gotta quit making statements like that Really lol its funny about the cats but yeah sorry..... and uhhh if you want the edit to be at the bottom and if it still didnt work (mine doesnt although it might be a different style) try using _GUICtrlEdit_Scroll Sir. I thank you very much for that post. I had to add these two includes to my ever growing list. #include <ScrollBarConstants.au3> #include <GUIEdit.au3> ... ; and your line fixed it right up _GUICtrlEdit_Scroll($status, $SB_SCROLLCARET) @enaiman I really do appreciate you taking the time to explain your example too. Yours does not need these extra includes so does that mean it would be a smaller compiled script in the end? Respectfully, avery Edited February 6, 2009 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org Link to comment Share on other sites More sharing options...
CodyBarrett Posted February 6, 2009 Share Posted February 6, 2009 no problem [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...
enaiman Posted February 9, 2009 Share Posted February 9, 2009 @ CodyBarrett _GUICtrlEdit_Scroll is a good one ... I was not aware that this function exists (actually the code I posted was taken fom an "old" script) ... of course is a much simpler solution. @ avery #include <ScrollBarConstants.au3> wouldn't add too much to your script; if you are concerned with this you can copy-paste the constant you need to your script and this way you don't need to include the whole file. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
CodyBarrett Posted February 10, 2009 Share Posted February 10, 2009 i just recently found the _GUIctrledit_scroll like a few days ago when i was updating my TCP chat room.. so dont feel bad the helpfile has a seemingly endless amount of goodies YOU GUYS HEAR THAT!!! ANYONE WHO ASKS FIRST THEN CHECKS!!! ALL HAIL THE HELPFILE!!!!!! but seriously i just found it so dont feel bad [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...
avery Posted February 10, 2009 Author Share Posted February 10, 2009 (edited) i just recently found the _GUIctrledit_scroll like a few days ago when i was updating my TCP chat room.. so dont feel bad the helpfile has a seemingly endless amount of goodies YOU GUYS HEAR THAT!!! ANYONE WHO ASKS FIRST THEN CHECKS!!! ALL HAIL THE HELPFILE!!!!!!but seriously i just found it so dont feel badI must be blind because I didn't find those in the help file anywhere. I even googled it after you make your post. I'd sure like to see the rest of the options.*meow*-avery Edited February 10, 2009 by avery www.abox.orgAvery HowellVisit My AutoIt Websitehttp://www.abox.org 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