string too long for debugger solution

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

string too long for debugger solution

Post by thefool »

What about when a string is too long for the debugger, user can hold
the mouse over the entry with the string, and get a tooltip up containing
whole line? Would help.-

Or if user double clicks the entry a messagerequester pops up with the whole line
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

Hello thefool,

Do you mean that you would like to see better strings that are too long when debugging your code ?

Here is the code I use to insert when designing :

Code: Select all

;
; HexDump for debugger
;
Procedure DebugSplittedString(String.s, Length.l)
  For i = 1 To Len(String)
    Debug Str(i) + " : " + Mid(String, i, Length - 1)
    i + Length - 1
  Next
EndProcedure

Procedure HexDump(Address.l, Length.l, Width.l)
  Debug "***** HexDump : " + Hex(Address) + " rendering " + Hex(Length) + " bytes"
  *Buffer = AllocateMemory(Length)
  CopyMemory(Address, *Buffer, Length)
  For i = 0 To Length - 1
    If PeekB(*Buffer + i) < ' '
        PokeB(*Buffer + i, ' ')
    EndIf
  Next
  For i = 0 To Length - 1
    a$ = ""
    For j = i To i + Width - 1
      a$ = a$ + RSet(Hex(PeekB(Address + j) & $FF), 2, "0") + " "
    Next
    Debug RSet(Hex(Address + i), 8, "0") + " | " + a$ + " - " + PeekS(*Buffer + i, Width)
    i + Width - 1
  Next
EndProcedure

  ;
  ; Generate a randomly filled string
  ;
  a$ = "The quick brown fox jumps over the lazy dog ... "
  a$ = a$ + a$
  a$ = a$ + a$

  Debug a$
  
  HexDump(@a$, Len(a$), 32)
  
  DebugSplittedString(a$, 80)
  
End
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

yes that can be used. Also you can resize the window, but what i mean is that i had a very long line, 2-300 chars, and it wasnt easy to see it. So if there was a scrollbar or the double-click or tooltip thing, it was maybe a bit easier..
oldefoxx
Enthusiast
Enthusiast
Posts: 532
Joined: Fri Jul 25, 2003 11:24 pm

Right on the button

Post by oldefoxx »

I concur with this need. The variable watch window should have horizontal stroll capabilities so that you can examine more than just the twenty or so characters of strings. In addition, it should be expandable to the full width of the screen so that you can observe more than a few characters at a time.

The debug method is obviously useful, but fails to allow for being able to post two or more strings, then scroll along their lenghts and make a visual comparison of one to the other. I use to be plagued with problems of trying to observe changes I was attempting to make or allow for in strings where the particular area fell outside limited view afforded by the rigid size and position of the view window.

Axiom: If you are going to have trouble with strings, it isn't going to be in a way or in a manner that is easily found or solved.
has-been wanna-be (You may not agree with what I say, but it will make you think).
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

I am searching a way to answer welll ... but cannot finish to run it well !

by inserting such code you get an horizontal scrollbar in the debug output listbox. But the scroll gadget does not move. Anyone to look further ?

Code: Select all

  hDebugOutput = FindWindow_("DebugOutput", "PureBasic - Debug Output")
  hListBoxDebugOutput = GetWindow_(hDebugOutput, #GW_CHILD)
  Style = GetWindowLong_(hListBoxDebugOutput, #GWL_STYLE)
  newStyle = Style | #WS_HSCROLL
  SetWindowLong_(hListBoxDebugOutput, #GWL_STYLE, newStyle)
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
Post Reply