the_lord_mephy Posted November 5, 2004 Share Posted November 5, 2004 Is there a way to add a line of text to a readonly Edit? My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
SlimShady Posted November 5, 2004 Share Posted November 5, 2004 Ofcourse. Here's an example. #include <GUIConstants.au3> AutoItSetOption("TrayIconDebug", 1) ;Initialize variables Global $style1 Global $IniFile Global $GUIWidth Global $GUIHeight $GUIWidth = 250 $GUIHeight = 250 GUICreate("New GUI", $GUIWidth, $GUIHeight) $Edit_1 = GUICtrlCreateEdit("", 10, 10, 230, 200, $ES_READONLY) $Button_1 = GUICtrlCreateButton("Test", 80, 220, 70, 20) GUISetState(@SW_SHOW) While 1 Sleep(25) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() Exit Case $msg = $Button_1 GUICtrlSetData($Edit_1, "Some text...") EndSelect WEnd Link to comment Share on other sites More sharing options...
the_lord_mephy Posted November 5, 2004 Author Share Posted November 5, 2004 (edited) Yeah, I knew how to change the text but what I wanted to know was, is there a way to add a line of text to an Edit. For example: Program started (Then a few minutes later it does something) Something began (A few minutes later it does something else) Something else done etc. So the edit would look like this: ---------------------- | Program started | | Something began | | Something else done | |______________________| Sorry, I should have been clearer. Edited November 5, 2004 by the_lord_mephy My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
Administrators Jon Posted November 5, 2004 Administrators Share Posted November 5, 2004 Yeah, I knew how to change the text but what I wanted to know was, is there a way to add a line of text to an Edit. For example:Program started (Then a few minutes later it does something)Something began (A few minutes later it does something else)Something else doneetc. So the edit would look like this:---------------------- | Program started | | Something began | | Something else done | |______________________|Sorry, I should have been clearer.Read the current text and then append a newline and the new text and then change the edit control to that. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
the_lord_mephy Posted November 6, 2004 Author Share Posted November 6, 2004 (edited) Thanks, works perfectly:) Edit: Heh, I made a very simple function for it: Func _EditAppendText($editname, $data) $a = GuiRead($editname) GuiCtrlSetData($editname, $a & $data) EndFunc Edited November 6, 2004 by the_lord_mephy My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
jpm Posted November 6, 2004 Share Posted November 6, 2004 easier just change the following line GUICtrlSetData($Edit_1, "Some text...",1) Link to comment Share on other sites More sharing options...
sandmanos Posted March 24, 2008 Share Posted March 24, 2008 Hi guys !I recently made my first script copying some files and then modifying content from them. Any action is logged in a text file created using _Filewritelog. It's working OK but now I'd like to display the refreshed content of the logfile into my GUI each time a new line is added. How could I replace the line "GUICtrlSetData($Edit_1, "Some text...")" appearing in your script with the refreshed content of my log file ? Thanks for responding Link to comment Share on other sites More sharing options...
martin Posted March 24, 2008 Share Posted March 24, 2008 Hi guys !I recently made my first script copying some files and then modifying content from them. Any action is logged in a text file created using _Filewritelog. It's working OK but now I'd like to display the refreshed content of the logfile into my GUI each time a new line is added. How could I replace the line appearing in your script with the refreshed content of my log file ? Thanks for responding Welcome to the forums Assuming you want to write the whole comtents of the log file to the edit thenGuiCtrlSetData($Edit_1,FileRead($PathToLogFile)) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
sandmanos Posted March 24, 2008 Share Posted March 24, 2008 Thanks for answering me, Martin ! Thanks to your explanation, my logfile's content is now displayed in my GUI. But I'm facing a problem with refreshment of that display : what I wanted to do is displaying the new content of the log file each time a line is written in it, i-e : LOGFILE: 1:30 PM line 1 added >> GUI: 1:30 PM line 1 displayed and then LOGFILE: 1:31 PM line 2 added >> GUI: 1:31 PM line 1 + line 2 displayed I haven't got a clue about how to do that ! Any suggestion ? Link to comment Share on other sites More sharing options...
martin Posted March 24, 2008 Share Posted March 24, 2008 Thanks for answering me, Martin !Thanks to your explanation, my logfile's content is now displayed in my GUI. But I'm facing a problem with refreshment of that display : what I wanted to do is displaying the new content of the log file each time a line is written in it, i-e :LOGFILE: 1:30 PM line 1 added >> GUI: 1:30 PM line 1 displayed and thenLOGFILE: 1:31 PM line 2 added >> GUI: 1:31 PM line 1 + line 2 displayedI haven't got a clue about how to do that ! Any suggestion ?Not sure from what you said that I know what you want.If you want to display only what's newer than is already shown in the edit then you could do something like this-$Logtext = FileRead($logfile)$Displayedtext = GuiCtrlRead($Edit_1)GuiCtrlSetData(StringReplace($logtext,$Displaytext,'')) Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
sandmanos Posted March 24, 2008 Share Posted March 24, 2008 Not sure from what you said that I know what you want.If you want to display only what's newer than is already shown in the edit then you could do something like this-$Logtext = FileRead($logfile)$Displayedtext = GuiCtrlRead($Edit_1)GuiCtrlSetData(StringReplace($logtext,$Displaytext,''))Yes, that's it ! It's working fine now !Thanks a lot for your help, Martin ! 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