Sunday, August 07, 2005

Fox Frame Debugger Tip

Those of you who have attended my Debugging Essentials presentation at a conference, user group, or via the Foxcast video know I generally prefer using the FoxPro Frame debugger instead of the Debug Frame. One of the disadvantages of using the FoxPro Frame is the need to close all the individual debugger windows to deactivate the debugger and remove the debugger toolbar. This can be a big time waster if you are jumping in and out of the debugger (something I do frequently).

If you use the Debug Frame all you have to do is close the Debugger Window. One click on the close button or one Alt+F4 keystroke and you are set. It obviously is not so fast with the FoxPro Frame. So after years of repetitively "slow closing" the debugger windows it hits me to write a program I can hotkey to open and close the windows. You can save the following code to a program (mine is called DebugWindows.prg)


PROCEDURE ShowDebugWindows

ACTIVATE WINDOW "call stack"
ACTIVATE WINDOW "debug output"
ACTIVATE WINDOW "watch"
ACTIVATE WINDOW "locals"
ACTIVATE WINDOW "trace"

RETURN

PROCEDURE HideDebugWindows

LOCAL lcOldOnError, llWindowNotActive

* Can replace with structured error handling
* if using VFP 8 or higher. You get an error
* if the window is not open
lcOldOnError = ON("Error")
ON ERROR llWindowNotActive = .T.

HIDE WINDOW "trace"
HIDE WINDOW "locals"
HIDE WINDOW "debug output"
HIDE WINDOW "watch"
HIDE WINDOW "call stack"

ON ERROR &lcOldOnError

RETURN

In my start up program I have these two lines:


ON KEY LABEL F7 DO ShowDebugWindows ;
IN "J:\WLCProject\Tools\DebugWindows"
ON KEY LABEL Ctrl+F7 DO HideDebugWindows ;
IN "J:\WLCProject\Tools\DebugWindows"


The code also works in the Debug Frame, although I am not sure what advantage this could be for a developer.

This is just one more simple example of how you can extend the Visual FoxPro IDE to make yourself productive. If you have not seen Craig Boyd's post called Visual FoxPro Community Action, go check it out. One of Craig's call to action is for VFP developers to extend the VFP IDE and to share ideas and code to do so. Just trying to do my little part.

1 Comments:

At 8/07/2005 02:54:00 PM, Blogger Craig Boyd said...

Thanks for the tip and code Rick. It is useful and appreciated.

 

Post a Comment

<< Home