Debugging Tip - Clicking on Object shows source line

This forum is for posting of useful information
Post Reply
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4728
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Debugging Tip - Clicking on Object shows source line

#1 Post by rdonnay »

I received the following email today from an eXpress++ user:
When you and I were training I saw you used DCBDEBUG in a way that you
could click on the app and the browse would refresh with the callstack
information listing appearing immediately.

How would I use DCBDEBUG to do that?

I am trying to inspect gui elements of an app and am unfamiliar with the
code. Thanks!
I have made the following video to describe how the attached sample program works:
http://bb.donnay-software.com:8080/tuto ... ebug1.html

You will need to add the following lines of code to your main program:

Code: Select all

DC_Sett('EDITOR','Q.BAT')  // Call q.bat as my editor
DebugConfig()              // Configure the debug window
DC_ReadGuiHandler({|a,b,c,d,e,f|DebugHandler(a,b,c,d,e,f)}) // install the global handler

STATIC FUNCTION DebugConfig()

LOCAL aConfig := { ;
   {'Row', ;
    'b', ;
    'Object Name', ;
    Chr(255), ;
    Chr(255), ;
    'Object;Proc' }, ;
   { 5, ;
     2, ;
     20, ;
     1, ;
     1, ;
     13 }, ;
   { nil, ;
     .f., ;
     nil, ;
     nil, ;
     nil, ;
     {||ProcInfo()} } }

DC_DebugBrowseConfig(2,aConfig)

RETURN nil

* -----------

FUNCTION DebugHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )

LOCAL aProc

IF nEvent == xbeM_LbClick
  DO WHILE Valtype(oXbp) == 'O'
    aProc := DC_GetProperty( oXbp, aGETLIST_PROC )
    IF Valtype(aProc) == 'A'
      IF Upper(aProc[1]) = 'DC_DEBUGWINDOWBROWSE'
        EXIT
      ENDIF
      ProcInfo( aProc[1] + '(' + Alltrim(Str(aProc[2])) + ')' )
      WTF oXbp WINDOW 2
      EXIT
    ENDIF
    oXbp := oXbp:setParent()
  ENDDO
ENDIF

RETURN DCGUI_NONE

* ------------

GETSETFUNCTION ProcInfo DEFAULT ''
You will also need to add this to the DCGETOPTIONS clause in each of your source files:

Code: Select all

DCGETOPTIONS .. SOURCEFILE __FILEPATH__ 
Attachments
debug.zip
Debugging sample
(1.93 KiB) Downloaded 779 times
The eXpress train is coming - and it has more cars.

Post Reply