Sunday, July 24, 2011

Some ramblings on the FoxPro Class Browser

Some time ago, I delved into the Class Browser, to extract and modify the code that allows you to drag the icon at the top left of the form and drop an instance of a class elsewhere.  (This was done more in the way of a challenge than anything else.).  I was able to do so; see Open Files

Then this last week, there was a UT thread that had to do with adding objects to columns, and I learned that there were other good suggestions on how to do this, but not using the Class Browser.  (I learned that you can do so by first selecting an object already in the column, and then dragging onto that column creates a sibling. -- but this seems quite cumbersome, and difficult to remember.)

Since I already had visited that same code and plunked it into PEM Editor, I took a look at it and found that there was an easy fix to allow dropping objects into a grid column.  Very easy in fact -- modifying exactly one line of code to include 'column' in the same list as 'container' and 'page'.

And this was enough to whet my appetite.

I have now made a few modifications to my own copy of the Class Browser:
  1. Problem with not being able to drag/drop objects into a column has been resolved.
  2. You can now drag an object onto the PEM Editor form, and the object will be added as a child or sibling of the currently selected object as displayed in the PEM Editor form.  This means you can select a column in a grid, or possibly a container that is obscured by other objects, and be able to safely drag/drop.  (You can drop it anywhere on the PEM Editor form.)
  3. The object dropped onto the form is now selected in both the Property Window and PEM Editor.
  4. Classes that are opened (double-clicking) now use (if available) the standard code available thru Thor for opening files.  See Managing MRU lists and Source Code Control.  
These are all minor changes, actually, with very very little code written.

I've been thinking about what else I might be able to accomplish.  (I like tinkering, this is how PEM Editor started).  So, some ideas:
  1. I find the organization of the TreeView to be all a jumble, not taking advantage of all that TreeViews offer.  I think that having root nodes that are the baseclasses, so that all the classes with the same baseclass would be grouped, would be a vast improvement.
  2. Unless I have it wrong, there does not seem to be a way to include all the classes in a project.  I would think that would be highly desirable.  (Apparently, adding a project adds ALL the files.  No doubt there is (was?) good reason for this, but I would think that in a class browser there should be some way to show just the classes.)
  3. I am seeing an occasional bug where the icon for some nodes is not shown.  I'd like to fix that.
  4. Is there really no way to drag a class directly from the TreeView node, without having to resort to using that obscure icon?
I have no idea which of any of these I will implement.  And, I wonder if there are other good ideas out there that I am not aware of.

Recent Beta releases of Thor and PEM Editor

With the releases to Beta of both Thor and PEM Editor over the last two weekends, I have moved ever closer to getting them ready to go to production.

The big stumbling block had been documentation, but that is now done -- there is is complete on-line documentation for both, see Thor Help and PEM Editor IDE Tools Help.  (Note that you can get to the individual page for one of the IDE Tools from with Thor, on the second page of the pageframe).

There are in fact lots of neat features here that had been 'hidden' previously, mainly because there was no way to learn of them.  They are now discoverable, at least for those who browse the various pages.

Two I would like to point out:

(1)  There is a small block of code that you can paste into one method in your ProjectHook class that will have a variety of benefits; see Managing MRU lists and Source Code Control.  It is not what you might think, easy enough to install, and should not interfere with anything you are already doing.

(2)  There has been a tool for some time that provides a different mechanism for finding classes; see Open Files.  Note that there is an icon in the upper left corner here which allows you to drag the currently selected class in the grid and drop it onto the form you are editing -- or, and this is brand new, you can drop it onto the PEM Editor form itself, which will cause it to be added to whatever object is currently displayed in PEM Editor. 

(There are distinct benefits to this if, for instance, the container you want to drop this on into is obscured by other objects.)

This last item has caused me to expand my interests a bit, to include the Class Browser.  More on that in a bit.