Jump to content

Write text to form background?


Go to solution Solved by Nine,

Recommended Posts

Posted

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.

Posted

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

 

Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...