Jump to content

Recommended Posts

Posted

When using the Debug Window I discovered that it is dynamically resized and repositioned but also can become inaccessible.

On one Display.
Notwithstanding I resize and reposition The Debug Window using e.g.

_DebugSetup($sDebugTitle)
WinMove($sDebugTitle, "", -0, 0, 500,  300),

when writing longer and longer records, the window is first horizontally displaced and centered on my screen and increases centered until the full width of my screen is filled with that window. The Vertical size however remains the original height.


If I use two displays, let's say A and B, of equal size, both in landscape mode, with A left of B, and B being the Main display.
In that case when WinMove positions the debug window on Display A, when text is written beyond the size of a single line that window jumps centered on the Main display B

 

If further testing with still 2 Displays, but now display A in portrait mode, and display B in landscape mode, display B still the main display.
If WinMove positions the window on display A at a vertical position which is not 'known' on the display B because now the height of (rotated)display A is now taller than the height of display B, writing the same byte stream as in both previous examples forces the Debug Window to jump at a non-displayed location, what results in the Debug window being Iconized on the taskbar.

Trying to restore that Window from the taskbar is now impossible as there is no valid pixel coordinate on either display to show the contents of the full window on one or both displays.

 

Question.
Is it possible to have the predetermined size and position of the Debug Window frozen, meaning not dynamically adapted according to the written contents?

Posted
Posted
ConsoleWriteOut(FileRead(@ScriptFullPath) & @CRLF)
ConsoleWriteOut()

Func ConsoleWriteOut($sStr = Default, $iErr = @error, $iExt = @extended)
    Local Static $hGUI = 0, $idEdit = 0, $iSciTE = StringInStr($CmdLineRaw, "/ErrorStdOut"), $hTimer = TimerInit()
    If $sStr = Null Then $hGUI = 1
    If Not $iSciTE And $hGUI = 0 Then
        Local $iW = 800, $iH = 400
        $hGUI = GUICreate(@ScriptName, $iW, $iH, -1, -1, 0x80CF0000) ; BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_THICKFRAME,$WS_TABSTOP))
        GUISetFont(10, 400, 0, "Courier New")
        GUISetIcon(StringTrimRight(@ScriptFullPath, 4) & ".ico")
        $idEdit = GUICtrlCreateEdit("", 1, 1, $iW - 1, $iH - 1)
        GUICtrlSetResizing(-1, 0x0066) ; $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM)
        GUISetState()
        GUICtrlSetData($idEdit, @CRLF)
    EndIf
    Local $iRet = ""
    If $sStr == Default And IsHWnd($hGUI) Then
        GUICtrlSetData($idEdit, @CRLF & "== DONE == ( " & Round(TimerDiff($hTimer), 4) & " ms. )", 1)
        Do
        Until GUIGetMsg() = -3
        GUIDelete($hGUI)
        Exit
    Else
        If $sStr <> Default And $iSciTE Then $iRet = ConsoleWrite($sStr)
        If $idEdit Then GUICtrlSetData($idEdit, $sStr, 1)
    EndIf
    Return SetError($iErr, $iExt, $iRet)
EndFunc   ;==>ConsoleWriteOut

I use the script above to have a "Console out / debug" that echo to console while in SciTE, but popup a window if not in SciTE ( click-click in explorer ).

I never used the included function so I can not help with that, but that is not the only way to do it and "my custom debug" does what I need. And this is a random "debug code" I use because at times I come up with different ideas.
If you need a solution that does one thing or another, just write it one.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
×
×
  • Create New...