Autoseek Posted October 1, 2016 Posted October 1, 2016 Hi everyone, I assume that this has already been solved, but my search for "GUI log(ging) window" did not return useful results. So, if available, a simple pointer to an exisiting solution is perfectly fine. I am an "old school" guy of progress logging, i.e., I am using tons of "ConsoleWrite" statements to indicate the current state, e.g., "Copying ABC to DEF...". Obviously, when I run the executable stand-alone, the output goes nowhere. Therefore, I would like to create a text GUI with scroll bar into which I can fire off the strings that are now contained in the "ConsoleWrite" statements. Perhaps worded differently, I would like to have the functionality of the SciTE-editor in a GUI, without having to put major efforts into just programming this functionality. I assume I am not the first one who needs this Thank you for any suggestions. Cheers Autoseek
AutoBert Posted October 1, 2016 Posted October 1, 2016 You can use $hLog = _GUICtrlEdit_Create($mainGui,'',8, 5, 467, 314, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY)) as Control showing the loglines and Func _report($sMsg, $hLog = 0, $iDebug = 0) ;=============================================================================== ; Autor(s): AutoBert (www.autoit.de) ; ; modified: durch/Grund hier anfügen ;=============================================================================== If $hLog <> 0 Then _GUICtrlEdit_AppendText($hLog, $sMsg & @CRLF) If $iDebug Then ConsoleWrite($sMsg & @CRLF) ;If $G__hFileLog > 0 Then _FileWriteLog($G__hFileLog, $sMsg & @CRLF) EndFunc ;==>_report to append a line. Autoseek 1
Autoseek Posted October 1, 2016 Author Posted October 1, 2016 Thank you so much. That's exactly what I was looking for. Already implemented, running like a champ Cheers Autoseek
Autoseek Posted April 11, 2018 Author Posted April 11, 2018 On 8.4.2018 at 9:28 PM, TekWeis said: Can you show an example of how to use this? Hmmm, I am afraid there is not really more to this than AutoBert has posted. This is what I did specifically. You create the container (CtrlEdit): $hLog = _GUICtrlEdit_Create($mainGUI, '', 8, 5, 467, 314, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY)) And later in your program you write into that container: _GUICtrlEdit_AppendText($hLog, $sMsg & @CRLF) That's all there is to it. In case it helps, here is the full GUI that I used: $mainGUI = GUICreate("Progress", 480, 372) $hLog = _GUICtrlEdit_Create($mainGUI, '', 8, 5, 467, 314, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN, $ES_READONLY)) $hCur = GUICtrlCreateLabel($mainGUI, 12, 330, 467, 20) GUICtrlSetData($hCur, "Running...") GUISetState(@SW_SHOW)
TekWeis Posted April 19, 2018 Posted April 19, 2018 Thank you. I finally caught it after I posted the message. Not sure what I was thinking.
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