littlebigman Posted December 9, 2023 Posted December 9, 2023 Hello, When all I need is to display text in a GUI window, is it possible somehow to write to a form's window directly, ie. not to an edit widget? #Region #GUI section Local $gui = GUICreate("Test", 360, 333) ;TITLE BAR ControlSetText("", "", $gui, "blah") ;NOTHING GUICtrlSetData($gui, "blah") GUISetState() #EndRegion While GuiGetMsg() <> $GUI_EVENT_CLOSE ;do stuff, including output to window WEnd Thank you.
Andreik Posted December 9, 2023 Posted December 9, 2023 You can use GDI to draw whatever you want in a GUI but it doesn't worth when you can create a label in a single line of code.
littlebigman Posted December 9, 2023 Author Posted December 9, 2023 (edited) I was hoping for a one-liner, but it does look more complicated. Thank you. --- Edit: How much data can a label store? And an edit widget? The GUICtrlCreate*() don't say. Edited December 9, 2023 by littlebigman
Subz Posted December 10, 2023 Posted December 10, 2023 It all depends on the size of the Window, if you want text longer than the size of the window, you would probably require a scrollbar to read it, GuiCtrlCreateEdit is better suited for this. You can also use label but this is suitable when the data doesn't require scrollbars. GuCtrlCreateEdit example: #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GuiEdit.au3> #include <ScrollBarsConstants.au3> #include <WindowsConstants.au3> Global $hGui = GUICreate("Test", 300, 300) Global $idEdit = GUICtrlCreateEdit(@YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC, 5, 5, 290, 290, BitOR($ES_READONLY, $ES_MULTILINE, $WS_VSCROLL)) _GUICtrlEdit_Scroll($idEdit, $SB_SCROLLCARET) GUISetState() AdlibRegister('_UpdateEdit', 1000) While 1 Switch GuiGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _UpdateEdit() Local $sMoreText = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC GUICtrlSetData($idEdit, GUICtrlRead($idEdit) & @CRLF & $sMoreText) _GUICtrlEdit_Scroll($idEdit, $SB_SCROLLCARET) EndFunc
littlebigman Posted December 10, 2023 Author Posted December 10, 2023 Thanks for the info. I did end up using an Edit widget. By "How much data", I meant how many bytes can it hold before AutoIt deletes old data to make space for new stuff?
argumentum Posted December 10, 2023 Posted December 10, 2023 9 minutes ago, littlebigman said: AutoIt deletes old data to make space for new stuff? Nope. Once full, is full. You handle that. You change the contents of the control ( or widget as you call it ). Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
littlebigman Posted December 10, 2023 Author Posted December 10, 2023 How can I tell the control can hold no more data, and it's useless to keep writing to it — so I should find a way to remove the oldest data to make room for more ? 33 minutes ago, argumentum said: Once full, is full. You handle that. You change the contents of the control ( or widget as you call it ).
Solution Nine Posted December 10, 2023 Solution Posted December 10, 2023 (edited) Here a list of maxima : https://www.autoitscript.com/autoit3/docs/appendix/LimitsDefaults.htm Start deleting when it gets close to 1GB, so there is room to maneuver FYI you can use : GUICtrlSetData($idEdit, $sMoreText & @CRLF, 1) to add to the end if the carret stays at end. Edited December 10, 2023 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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