Finder

An advanced search tool for names of files and Visual FoxPro classes in projects or folders.

SNAGHTML2f90eaf

Getting Started:  Like all VFPX projects, Finder can be downloaded using Thor. If you have Thor installed, Finder shows up in “Check For Updates”.  If not, see Thor installation instructions

Then watch the Finder introductory video.

Note that Finder requires that Thor be active in order to work, as it is based on various Thor components.

It looks a lot like GoFish!  This is by design. Finder and GoFish are companion search engines. Both search VFP projects or folder/sub-folders, looking for different types of matches

  • Finder searches for names of files or classes.
  • GoFish searches for references in code.

Tooltips and context menus: Tooltips have been used fairly extensively, and the context menu on the rows in the grid provides a number of different options depending on the type of file selected.

Timestamps for SCXs, VCXs, and Classes:  The timestamps displayed for SCXs and VCXs do not show the timestamp of the last time the file was changed (which may have occurred when building a project) but instead the most recent timestamp from the rows in the SCX/VCX. Similarly, the timestamps for classes are based on the most recent timestamp from the rows for the class.

Source Control:  The options form, shown below, gives an option so that you will be asked whether you want to check out a file (if Source Control is used in the current project) before opening.

Other Source Control-related options may be added at a later date if there is interest.

(See further discussion of this at the very end, under the topic MRU Lists)

SNAGHTML3afea22

Searching

Basic Searching

The most basic and also most commonly used form of searching is to enter part of a file name or class name. The result is all files or classes where the entered text is part of the name. You can use wildcards (‘?’ and ‘*’) in your search. Searching is done by assuming a leading and trailing ‘*’ and using the LIKE() function.

You can search for all file or class names by simply leaving the search field blank.

Advanced Searching

To find names beginning with text you enter, begin with ‘^’.

To find names ending with text you enter, end with ‘$’.

To find exact name matches with the text you enter, use ‘!’ at the beginning or end.

Searching for File Name Extensions

To restrict your search to a particular file name extension, enter a dot and the extension after the search text. For example, “JOB.PRG” would find all PRG files that contain the text “JOB”

You can use wildcards when specifying an extension. “JOB.?CX” would search all forms and class libraries.

You can search multiple file extensions by entering each of them, separated by dots. Thus, you could also search all forms and class libraries by entering “JOB.SCX.VCX”

Searching Path Names

To search for names that are part of the full path for a file, follow the path name with ‘\’. For instance, searching for Job\Show will find all files where Job is part of the the path name and Show is part of the stem name. The actual search phrases used is *JOB*\*SHOW*.*

To search for all names in a particular folder, enter the folder name followed by ‘\’.

Examples:

SHOW             == *SHOW*.*

SHOW.SCX    == *SHOW*.SCX

'\' means you are searching the path as well, and is interpreted as *\*

JOB\                == *JOB*\*.*                    Entire folder

JOB\SHOW   == *JOB*\*SHOW*.*    All files in JOB folder with SHOW in name

JOB\.SCX       == *JOB*\*.SCX              All SCX files in JOB folder

Scope

The scope for your search may be either a project (which need not be open) or a folder (including sub-directories). The drop-down list shows a MRU list of projects and folders. In the options form you can also create a “Favorites” list of projects and/or folders to appear in this drop-down list.

Operations on Files or Classes

The original concept of this tool was to provide a simple mechanism for finding and opening files. Double-clicking any row in the grid will open the selected file or class. The underlying mechanism here is the FoxPro function EditSource(). There are a few other things that occur when the file is opened:

  • The file is opened using the same case as the file name on disk, so the case of the file name will not be changed.
  • The file is added to the appropriate FoxPro MRU list. Other Thor tools allow you to access these lists without visiting the command window. 
  • If you use Source Control, you can use the Options form to indicate that you want to be asked to check out files from Source Control before opening them.

You can also right-click on any row in the grid for a context menu. This items in this menu are sensitive to the extension of the file or class selected, and may include any of these options:

  • Open (same as Dbl-Click)
  • Run (for PRGs, SCXs, and FRXs)
  • Open with HackCX (this option is always available but only works if HackCX is installed)
  • Create VCA/SCA/etc. file using SCCTextX
  • Pack
  • Modify Structure
  • Reindex
  • Look up Reference (if GoFish is installed – finds all references to the form/class)
  • NewObject (inserts call to Object)
  • Create subclass
  • Create duplicate class
  • Descendant Classes
  • Sibling Classes
  • Where Used (where this class or its descendant classes are used)
  • Add to or Remove from current project
  • Open folder in Explorer
  • CD to this folder
  • Set scope to this folder

PRG-based classes 

 

Finder locates classes that are defined in PRG and handles them just as it handles visual classes in VCXs

Sorting or filtering the Grid

You can sort the grid by clicking on a column header.

You can filter the rows in the grid by right-clicking in a column header (other than the timestamp or size columns).

Drag/Drop classes

 

When you have searched for classes, you can drag the class from the current highlighted row in the grid and drop it on a form or class you are editing.  You can begin dragging it by either:

  • Dragging the icon that appears just above the upper left hand corner of the grid.
  • Or holding down the Shift or Ctrl key and dragging the row from the grid.

You can then drop the class onto a form or class you are editing, just like you do from the Class Browser. If the object under the mouse is a container, the class is added as a child object in the container, else it is added as a sibling.

 

As an alternative, you can also drop the class on PEM Editor. In this case, the object is added as a child or sibling of the object that is current displayed in PEM Editor. This makes it very easy to drop classes into hard to get at places, such as columns in a grid or containers that are obscured in the form/class being edited. Simply navigate to the container object (using PEM Editor, Property Window, etc.) and then drop the class onto PEM Editor.

 

Persistence of Settings

Most of the settings of the form persist from session to session, including its size and position, search text, scope, column widths and order, the results grid, and the current row in that grid

Dockable vs not-dockable

By default, the form is dockable. This choice was not made because of the expectation that the form will ever be docked, but rather because of three effects of making it dockable.

  1. When opened, it goes on top of all other forms, including other dockable forms.

  2. It can be moved outside the visible FoxPro screen

  3. The setting for Dockable can be turned off by right-clicking the titlebar of the form

You can turn off the Dockable setting, allowing the form to go behind other non-dockable windows, if desired, as long as you are careful to do so when the form is within the FoxPro screen and is not on top of a dockable window.

MRU Lists and Source Control

As noted earlier, any file opened is automatically added to the appropriate FoxPro MRU list, as if it had been opened from the command window.  These MRU lists can be accessed by right-clicking on either the “File Search” button (for files) or the “Class Search” button (for classes and class libraries).

MRU lists are not kept current when files are opened from either the Project Manager or the Class Browser (an unfortunate oversight). However, this can be corrected by using files found in folder Thor\Tools\Samples:

  • Class Library ‘BaseProjectHooks.VCX’ contains a class that can be used as a ProjectHook for a project. If you are already using a ProjectHook class, you can simply use the QueryModifyFile method from this class.
  • File ‘Browser.APP’ can be used to replace the file of the same name in Home(1).

If you are using Source Control in the current project, each of these replacement programs will also ask whether you want to check out the file before opening it.

Last edited Dec 28, 2013 at 12:14 AM by mattslay, version 24

Comments

Steingo Oct 21, 2014 at 5:55 AM 
Finder 1.1 Release Notes (Dec 2013)
There are numerous updates to Finder in this release, as listed below.

Most of these enhancements were due to suggestions by Rick Schummer at SW Fox this year, noting that with these suggestions Finder provides many of the common features of the Project Manager, but with a more usable UI.

[1] You can have multiple instances of Finder open, one for each open project.

This capability is enabled by using a new option in the Finder Options dialog:





Thereafter, any time you open Finder, it creates a new instance of Finder for the active project (or uses the one already open for that project). When you close an instance of Finder that is project related, its settings are saved for the next time Finder is used for that project.

[2] You can open Finder programmatically for a project by executing:

Execscript(_Screen.cThorDispatcher, 'Thor_Proc_Finder.PRG', <projectname>)

where <projectname> is the name and full path of the project.

[3] The context menu for a file allows you to add or remove the selected file to any project that is open, not only the active project.

[4] There is a new button to build a project, mimicking the behavior of “Build” in Project Manager.

[5] There is a Plug-In PRG that can be called when the “Build” button is clicked.

[6] The search phrase for files has been expanded to allow for matches (include partial matches) to the names of folders in the fully expanded path name of a file. To do so, use a backslash. Examples:

SHOW == *SHOW*.*
SHOW.SCX == *SHOW*.SCX

'\' means you are searching the path as well, and is interpreted as *\*
JOB\ == *JOB*\*.* Entire folder
JOB\SHOW == *JOB*\*SHOW*.* All files in JOB folder with SHOW in name
JOB\.SCX == *JOB*\*.SCX All SCX files in JOB folder

[7] An infinite loop, reported and fixed by Mike Potjer, has been removed.

[8] The Escape key now closes the form (suggested by Matt Slay)

billand88 Jun 27, 2014 at 6:49 PM 
Duplicate hot keys!

There's a duplicate hot key in the displayed Finder dialog -- Class Search command button and the Current Dir. check box. Also, the Scope label and the Path/ClassLibs (not in diagram) have duplicate hot keys.

If you select a file name with a .DBF extension and right click, another duplicate hot key appears -- the Reindex menu bar and the Look Up Reference... menu bar.

If you select a file name with a .Frx or .Scx extension and right click, another duplicate hot key appears -- the Run menu bar and the Look Up Reference... menu bar.

In the right click menu, select the Filter on menu pad. Three menu bars appear, and there's a duplicate hot key -- File Name menu bar and the Folder menu bar.