Jump to content
Sign in to follow this  
lokatylokacz

Log in GUICtrlCreateEdit

Recommended Posts

Hello!

How to create something like GUI script log.

I made GUICtrlCreateEdit (read only) and I wanna add there new msg depending on that was is going on with the script.

My problem is that if I use GUICtrlSetData it cleans msg that was there b4 so I can just see last change in log. How to deal with it ?

Share this post


Link to post
Share on other sites

@lokatylokacz there are several ways to do it (as with most things in AutoIt). In essence, you need to read in what text is in the edit control and add that to your GUICtrlSetData. Something like this perhaps:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Local $hGUI = GUICreate("Test", 300, 300)
Local $hEdit = GUICtrlCreateEdit("", 10, 10, 280, 200)
Local $btnGo = GUICtrlCreateButton("Go", 250, 250, 40, 40)

GUISetState(@SW_SHOW)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $btnGo
                GUICtrlSetData($hEdit, @TAB & "========Initializing Program========" & @CRLF)
                    For $a = 1 To 10
                        GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & "===Executing Line " & $a & " of Program===" & @CRLF)
                    Next
                GUICtrlSetData($hEdit, GUICtrlRead($hEdit) & @TAB & "========Program Complete========")
        EndSwitch
    WEnd

 


"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

@JLogan3o13

Couldn't he just use the default parameter of GUICtrlSetData() set as non-empty value to append data to the Edit control instead of reading and concatenating each time the new data? :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@lokatylokacz

GUICtrlSetData($youreditcontrol, "Line 1" & @CRLF, -1)
GUICtrlSetData($youreditcontrol, "Line 2" & @CRLF, -1)

 


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@lokatylokacz

Happy to have helped :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

@FrancescoDiMuro you are 100% correct, I made something of a Rube Goldberg machine there :>

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...