The watch window is an extremely useful tool, but it often gets very cluttered. There is no obvious way of clearing out the entries and starting with a clean slate - other than to laboriously select each item in turn and hit the Del key. Nor can you easily sort the items alphabetically. The only obvious way of doing that is to delete individual items and re-enter them in the desired order.
Fortunately, there are a couple of tricks that will help you manage your watch window entries.
The resource file
The entries are held in the Foxuser resource file, in a record whose ID is WATCHEXPR. Within that record, the entries can be found in a memo field called Data. However, if you want to delete the entries, donÆt simply delete the contents of the memo field. If you do, youÆll get an error message the next time you open the debugger.
You can, however, safely delete the entire record. This will clear out all the watch window entries, and might also reset your debugger window layout, although other debugger settings, like breakpoints, will remain intact.
The debugger configuration file
A better approach is to use a debugger configuration file. This is the file that is created when you select Save Configuration from the debuggerÆs File menu. It contains various debugger settings, including the watch window entries.
Now, the configuration file (which has the extension DBG) is an ordinary text file. You can open it in a text editor and edit the entries to suit your needs. The watch window entries begin with WATCH=, as in this example:
So you can manually add and delete entries, or arrange them in whatever order you like. The next time you go into the debugger, select Load Configuration from the File menu to restore the saved settings.
A good way of using this technique is to create a standard DBG file with a core set of your favourite watch window entries. During a debugging session, add more entries to the window in the usual way. From time to time, re-load the DBG to restore your favourites. The process only takes a couple of clicks but will make your use of watch window that little bit easier.