FoxPro Tips: Project Manager Dragging and Dropping
Some developers are surprised to find out that the Project Manager is a drag-n-drop client and server. This means that files can be dragged to the Project Manager from many sources including other projects and from outside of Visual FoxPro. If you drag files from the Windows Explorer all the files will be added to the project.
Dragging from one project to another
Dragging files between two different projects creates a reference in the second project for that file. If there is a description for the file, this description is also added to the second project, even for files that don't store the description in the file itself. If the file is a program set as the main program of the originating project, VFP will prompt you with a question that asks if you want to make the file the main program in the second project. You do not need to be on the same page in each project. The file is naturally added to the correct category based on the file extension.
Drag objects from a project to a designer
Dragging files from the project to a form or class designer can save time during development. Many project objects can be dragged to the Form or Class Designer. The dropped objects are instantiated in the designer.
Dragging a field from a database contained table, view, or free table to a form or class will instantiate the associated class for the data type. The advantage of this feature is that it creates a bound object in the class without the use of a dataenvironment. Many developers I have mentored over the years feel they need to first drop on a class and then set the ControlSource.
While the manual setting of the ControlSource works, it requires developers to perform an extra step. The other advantage of this technique is that it incorporates the IntelliDrop capability seen when you perform this operation from the dataenvironment. This way the classes specified in advance are used instead of the VFP base classes. Tables dragged to a form or class will instantiate a grid. If you right-click and drag, you are presented with the option of the grid class (or other class you have set for the Multiple setting in the Field Mapping in the Tool|Options or via the Task Pane Environment Manager).
If you want a specific class dropped on another container class, you can select it in the Project Manager and drag it to the container class. This does not bind the object like the drag operation of a table field. This allows you to override the IntelliDrop settings that are premapped. I expected that an icon dropped on a form might set the form Icon property and that dropping a graphic would generate an image object. They don't. Other objects not mentioned in this section cannot be dropped onto a form or container class.
Dragging from project to program code
In the same spirit described in the preceding section, you can drag and drop different project objects to code editors. The name of the object is displayed in the code window. For instance, if you drop a field name in the Command Window, you get the field name. Unfortunately you do not get the table.fieldname syntax. This works for every object type in the project except the stored procedure names. The only objects that carry over the file extension are the files in the "other" category.
0 Comments:
Post a Comment
<< Home