How To Extend the Visual FoxPro Solutions Sample

Last reviewed: February 19, 1998
Article ID: Q157723
5.00 WINDOWS kbusage kbprg kbprint kbhowto

The information in this article applies to:

  • Microsoft Visual FoxPro for Windows, version 5.0

SUMMARY

The Visual FoxPro Solutions sample can easily be extended by adding new components. This article describes the steps required to add a new form, query, view, or report to the Solutions sample.

MORE INFORMATION

Adding a New Component to Solution.dbf

To add a new component to the Solutions sample, add a new record to Solution.dbf and fill in the following fields.

The Key Field:

The Key field must be unique, and it must be a number followed by an underscore, 205_ for example. The Key field is used to populate the treeview control (oleTree) in Solution.scx.

The Parent Field:

The Parent field must match the Key value of the record for the parent node of the sample in the treeview. For example, if you want to add a new component to be displayed under "ActiveX\ActiveX Controls" in the Solution.scx treeview, replace the Parent field with 101_. A Parent of 0_ indicates that the item is added to the root level of the treeview control.

The Text Field:

The text you enter in the Text field is displayed in the treeview control and the filtered list view in Solution.scx.

The Image Field:

The Image field specifies the picture to be displayed beside the component in the treeview. If you are adding a component to be run, set the picture to "dot."

To see all the images, right-click oleImages in Solution.scx and choose ImageList Control Properties.

The File Field:

The File field contains the name of the new sample file.

The Type Field:

Fill in the Type field as follows:

   N -- Not a sample
   F -- Form
   V -- View
   Q -- Query
   R -- Report

The Path Field:

The path of the new sample file, relative to the directory that Solution.scx is located in.

The Descript Field:

The Descript field contains the description that is displayed in Solution.scx when the sample is selected in the treeview or in the list box.

The Method Field (for forms only):

If you want a form to be opened in design mode with a particular method opened by default, specify the method in the Method field.

Customizing a Form for the Solutions Sample

Queries, reports, and views don't need any special coding to be good Solution application citizens, but forms do need a little customization.

  1. Add the c_solutions class from VFP\SAMPLES\SOLUTION\SOLUTION.VCX to your form. Keep the default name of c_solutions1.

  2. Add the following lines to the Activate event of the form:

            IF TYPE('THIS.c_solutions1') = "O"
          THISFORM.c_solutions1.SaveHelp
            ENDIF
    
    

  3. Add the following lines to the Deactivate event of the form:

            IF TYPE('THIS.c_solutions1') = "O"
          THIS.c_solutions1.RestoreHelp
            ENDIF
    
    

  4. Add the behindscenes class from Vfp\Samples\Solution\Solution.vcx to your form, and make sure the HelpContextID of the form is set to 0, the default. This opens the solutions overview topic when a user chooses the Behind the Scenes button or presses F1.

If you want to provide a Help topic for your component, you need to make a change to c_solution and make sure that the user gets the updated copy. The cHelpFile property of c_solution is protected, but it should not be. When you create a help file for your new component, set the cHelpFile property of c_solutions1 to the name of your help file.

Adding a New Component to the Filtered List View

The filtered list isn't a filtered list at all: the list displays one side of a many-to-many relationship. Each Solutions component can be listed under multiple "filters" and each "filter" can contain many components. The tables involved in the relationship are as follows:

   Solution.dbf--The list of components
   Reftext.dbf--The list of "filters" and an ID
   Xref.dbf--A juncture table between Solution and Reftext

If your new component belongs under one or more of the existing filters, add records to Xref.dbf with the ID of the filter in Reftext.dbf and the Key value for your component from Solution.dbf. If you want to add another filter, add the new filter to Reftext.dbf.

REFERENCES

For a sample form that can be used to facilitate the adding of new components and filters to the sample, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q158051
   TITLE     : SAMPLE: Solution.exe Extends the Visual FoxPro Solutions
               Sample


Extract the form Filtrlst.scx from Solution.exe. For best results, these files Filtrlst.scx and Filtrlst.sct should be placed in the Vfp\Samples\Solution directory. The form itself contains instructions about its use.

All components in Solution.dbf are listed when the filter is set to "All," whether you have added your component to other filters or not.


KBCategory: kbusage kbprg kbprint kbhowto
KBSubcategory: FxprintFont
Additional reference words: kbdse 5.00 vFoxWin example sample
Keywords : FxprintFont kbhowto kbprg kbprint kbusage
Version : 5.00
Platform : WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 19, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.