Sign in to follow this  
Followers 0
Chlar

Change graphics on _DebugSetup() window

7 posts in this topic

Hi everybody,

I'm quite new at autoIt and my aim on this program is to separate the appeared window, with the _DebugSetup() function, in 2 columns.

I don't know if i'm am clear but my real question is: Is that window a GUI and how can i change its parameters.

To help you understand, here's a screenshot of the kind of debug window i want :

http://imageshack.us/photo/my-images/801/sanstitrexyf.png/

If it's a GUI, how can i split the window?

I succeded on change the window size with "WinMove" but didn't get the inside of the window...

Cheers!

Share this post


Link to post
Share on other sites



Hi James,

I want the same result as if i used the function GUICtrlCreateListView which create 2 columns in this situation:

GUICtrlCreateListView("Task | Status",10,10,580,780)

Share this post


Link to post
Share on other sites

Hello!

Try this ;)

#include <Debug.au3>
#include <String.au3>

_DebugSetup("Debug with 'splitted' view") ; start displaying debug environment

_DebugOut(_LenGroupedOutput(50, " ", 0, "Task;Status"))
GUICtrlSetFont(-1, Default, Default, Default, "Courier New")    ;setup a 'fixed-width font'
_DebugOut(_StringRepeat("-", 70))


_DebugOut(_LenGroupedOutput(50, " ", 0, "Version choice;Done"))
_DebugOut(_LenGroupedOutput(50, " ", 0, "Say hello;Done"))
_DebugOut(_LenGroupedOutput(50, " ", 0, "Say goodbye;Failed"))


#region _LenGroupedOutput() example
Local $aTest[8]

For $i = 1 To 5
    For $j = 0 To UBound($aTest) - 1
        $aTest[$j] = Random(10, 10000, 1)
    Next
    ConsoleWrite(_LenGroupedOutput(10, " ", 0, $aTest) & @CRLF)
Next

ConsoleWrite(@CRLF)

For $i = 1 To 5
    For $j = 0 To UBound($aTest) - 1
        $aTest[$j] = Random(10, 10000, 1)
    Next
    ConsoleWrite(_LenGroupedOutput(10, ".", 1, $aTest) & @CRLF)
Next
#endregion _LenGroupedOutput() example

;http://www.autoit.de/index.php?page=Thread&threadID=29227
Func _LenGroupedOutput($sLen, $charFill, $iAlign, $s_or_a, $sSep = ";")
    Local $sSinglePattern, $sPattern
    If Not IsArray($s_or_a) Then
        $s_or_a = StringSplit($s_or_a, $sSep, 2)
    EndIf
    If UBound($s_or_a) > 32 Then Return SetError(1)

    If $iAlign = 0 Then
        $sSinglePattern = "%-" & $sLen & "s"
    Else
        $sSinglePattern = "%" & $sLen & "s"
    EndIf
    For $i = 1 To UBound($s_or_a)
        $sPattern &= $sSinglePattern
    Next
    ReDim $s_or_a[32]
    Local $sRet = StringFormat($sPattern, $s_or_a[0], $s_or_a[1], $s_or_a[2], $s_or_a[3], $s_or_a[4], $s_or_a[5], $s_or_a[6], $s_or_a[7], $s_or_a[8], $s_or_a[9], $s_or_a[10], $s_or_a[11], $s_or_a[12], $s_or_a[13], $s_or_a[14], $s_or_a[15], _
            $s_or_a[16], $s_or_a[17], $s_or_a[18], $s_or_a[19], $s_or_a[20], $s_or_a[21], $s_or_a[22], $s_or_a[23], $s_or_a[24], $s_or_a[25], $s_or_a[26], $s_or_a[27], $s_or_a[28], $s_or_a[29], $s_or_a[31], $s_or_a[31])
    Return StringReplace($sRet, " ", StringLeft($charFill, 1))
EndFunc   ;==>_LenGroupedOutput

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Thank you funkey it helped a lot and its exactly what i was looking for!

I have another question: can i put buttons on this window ?

Share this post


Link to post
Share on other sites

Yes you can add buttons to this debug window, but this UDF is not really made for this and I would never do this. I always would build my own gui to fit my needs.

Having said that, here is an example code to add a button to the debug gui.

#include <Debug.au3>
#include <String.au3>
#include <GUIConstantsEx.au3>

_DebugSetup("Debug with 'splitted' view") ; start displaying debug environment

_DebugOut(_LenGroupedOutput(30, " ", 0, "Task;Status"))
GUICtrlSetFont(-1, Default, Default, Default, "Courier New") ;setup a 'fixed-width font'
GUICtrlSetPos(-1, 4, 4, 572, 242) ;make edit control a bit smaller, so that there is space for buttons
GUICtrlSetResizing(-1, 102)

Global $nButton = GUICtrlCreateButton("Button 1", 30, 250, 120, 25)
GUICtrlSetResizing(-1, 768 + 64 + 2)

OnAutoItExitUnRegister("__Debug_ReportClose")

_DebugOut(_StringRepeat("-", 60))

_DebugOut(_LenGroupedOutput(30, " ", 0, "Version choice;Done"))
_DebugOut(_LenGroupedOutput(30, " ", 0, "Say hello;Done"))
_DebugOut(_LenGroupedOutput(30, " ", 0, "Say goodbye;Failed"))

Global $iMsg
While 1
    $iMsg = GUIGetMsg()
    Switch $iMsg
        Case $nButton
            ConsoleWrite("Debug button pressed!" & @CRLF)
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
WEnd


;http://www.autoit.de/index.php?page=Thread&threadID=29227
Func _LenGroupedOutput($sLen, $charFill, $iAlign, $s_or_a, $sSep = ";")
    Local $sSinglePattern, $sPattern
    If Not IsArray($s_or_a) Then
        $s_or_a = StringSplit($s_or_a, $sSep, 2)
    EndIf
    If UBound($s_or_a) > 32 Then Return SetError(1)

    If $iAlign = 0 Then
        $sSinglePattern = "%-" & $sLen & "s"
    Else
        $sSinglePattern = "%" & $sLen & "s"
    EndIf
    For $i = 1 To UBound($s_or_a)
        $sPattern &= $sSinglePattern
    Next
    ReDim $s_or_a[32]
    Local $sRet = StringFormat($sPattern, $s_or_a[0], $s_or_a[1], $s_or_a[2], $s_or_a[3], $s_or_a[4], $s_or_a[5], $s_or_a[6], $s_or_a[7], $s_or_a[8], $s_or_a[9], $s_or_a[10], $s_or_a[11], $s_or_a[12], $s_or_a[13], $s_or_a[14], $s_or_a[15], _
            $s_or_a[16], $s_or_a[17], $s_or_a[18], $s_or_a[19], $s_or_a[20], $s_or_a[21], $s_or_a[22], $s_or_a[23], $s_or_a[24], $s_or_a[25], $s_or_a[26], $s_or_a[27], $s_or_a[28], $s_or_a[29], $s_or_a[31], $s_or_a[31])
    Return StringReplace($sRet, " ", StringLeft($charFill, 1))
EndFunc   ;==>_LenGroupedOutput

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Nice one!

But i will follow your advice as create my own GUI

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  
Followers 0