Page 1 of 1

[Implemented] Clear Debug Window

Posted: Mon Dec 01, 2003 1:03 am
by freedimension
I'm asking for a possibilty to clear the debug output window with

a) a command (like DebugClear)
b) a button within the window itself

(See 'ClearDebugOutput()')

Posted: Mon Dec 01, 2003 1:02 pm
by Num3
Nice thinking!

I would really enjoy those commands!

Posted: Mon Dec 01, 2003 7:51 pm
by Berikco
Yeah, i vote for that :)

Posted: Mon Dec 01, 2003 10:16 pm
by Froggerprogger
And the debug-window should store it's last size. The window is so often too narrow for me... 8O

Posted: Mon Dec 01, 2003 11:23 pm
by freedimension
Froggerprogger wrote:And the debug-window should store it's last size...
and position.

Posted: Sun Dec 14, 2003 5:01 am
by Michel_k17
...and in the background (foreground gets too much in the way),
and the Debug and Variable windows should be in one window with a splitter bar. Something like VB6.

Haaa.... I feel better!

Re: Clear Debug Window

Posted: Sun Dec 14, 2003 9:25 am
by Danilo
freedimension wrote:I'm asking for a possibilty to clear the debug output window with

a) a command (like DebugClear)
Good Idea.

Fred should add it directly to the debugger, but here a
workaround because you dont know if Fred wants to add it. :D

Code: Select all

;
; by Danilo, 14.12.2003 - english forum
;
Procedure DebugClear_Callback(hWnd,Value)
  result = 1
  ClassName$ = Space(100)
  GetClassName_(hWnd,@ClassName$,100)
  If ClassName$ = "ListBox"
     Count = SendMessage_(hWnd,#LB_GETCOUNT,0,0)
     If Count > 0
       SendMessage_(hWnd,#WM_SETREDRAW,0,0)
       For a = 0 To Count - 1
         SendMessage_(hWnd,#LB_DELETESTRING,0,0)
       Next a
       SendMessage_(hWnd,#WM_SETREDRAW,1,0)
       InvalidateRect_(hWnd,0,1)
     EndIf
     result = 0
  EndIf
  ProcedureReturn result
EndProcedure

Procedure DebugClear()
  hDebug = FindWindow_(0,"PureBasic - Debug Output")
  If hDebug
    EnumChildWindows_(hDebug,@DebugClear_Callback(),0)
;  Else
;    MessageRequester("DEBUG CLEAR","Debugger Disabled!",#MB_ICONERROR)
  EndIf
EndProcedure


For a = 1 To 100
  Debug Str(a)
Next a

Delay(1000)

DebugClear()

Debug 12

Remember my old code to save debug output?
Still not added to the PB Debugger... :?

Code: Select all

Procedure SaveDebugTextCallback(hWnd,Value)
  ClassName$ = Space(100)
  GetClassName_(hWnd,@ClassName$,100)
  If ClassName$ = "ListBox"
     Count = SendMessage_(hWnd,#LB_GETCOUNT,0,0)
     If Count = 0
        MessageRequester("DEBUG SAVE","No Data in Debug Output",#MB_ICONINFORMATION)
     Else
        If OpenFile(1,PeekS(Value))
           FileSeek(Lof())
           WriteStringN(";---[ New Entry ]-------")
           GetLocalTime_(time.SYSTEMTIME)
           WriteStringN("; - Date: "+StrU(time\wDay,1)+"."+StrU(time\wMonth,1)+"."+StrU(time\wYear,1))
           WriteStringN("; - Time: "+StrU(time\wHour,1)+":"+StrU(time\wMinute,1))
            For a = 0 To Count - 1
                Length = SendMessage_(hWnd,#LB_GETTEXTLEN,a,0)
                Text$   = Space(Length)
                SendMessage_(hWnd,#LB_GETTEXT,a,@Text$)
                WriteStringN("  | "+Text$)
            Next a
           WriteStringN(";---[ End Entry ]-------")
           WriteStringN("")
           CloseFile(1)
           MessageRequester("DEBUG SAVE","Saved Debugger Output to:"+Chr(13)+PeekS(Value),#MB_ICONINFORMATION)
        Else
           MessageRequester("DEBUG SAVE","Couldnt save Debug Output",#MB_ICONERROR)
        EndIf
     EndIf
  EndIf
ProcedureReturn 1
EndProcedure
 
 
Procedure SaveDebugOutput(File$)
hDebug = FindWindow_(0,"PureBasic - Debug Output")
If hDebug
   EnumChildWindows_(hDebug,@SaveDebugTextCallback(),@File$)
Else
   MessageRequester("DEBUG SAVE","Debugger Disabled!",#MB_ICONERROR)
EndIf
EndProcedure


; Code Start
 
SaveDebugOutput("c:\PB_DEBUG.TXT")
Debug "TEST"
Debug Str(12)+" PureBasic Debug"
Debug "testing..."
Debug 123456
SaveDebugOutput("c:\PB_DEBUG.TXT")
Its the same with remembering the position and size of all
debug windows. Users requested this long long time ago,
but somebody doesnt seem to care about it...

Re: Clear Debug Window

Posted: Sun Dec 14, 2003 10:27 am
by Rings
Danilo wrote:....but somebody doesnt seem to care about it...
i cannot remember the meaning of lazyness.........

Re: Clear Debug Window

Posted: Sun Dec 14, 2003 11:04 am
by Berikco
Rings wrote:
Danilo wrote:....but somebody doesnt seem to care about it...
i cannot remember the meaning of lazyness.........
yes, me also can't remember what lazy means....mmmm

Posted: Sun Dec 14, 2003 11:41 am
by Fred
same for me... strange.