To begin you do not need any special classes, you can try VFP2IIS directly on simple form. Below are some recommendations for 3 possibilities :
- Experimentation with a new form
- VFP2IIS_DEMO as example
- Experimentation with existing project
Before examination you must keep in mind the global restriction of VFP2IIS: VFP2IIS runs in multithread mode and is "external" of your application.
You must handle following issues in your code (with branch "IF _VFP-STARTMODE=5 ........ ELSE existing code ENDIF"):
- Limitation in VFP9T, especially modal state - dialogs like LOCFILE(), MESSAGEBOX,WAIT, INPUT etc.
- Forms handled by VFP2IIS must be registered in VFP2IIS (known for VFP2IIS). Forms must be created calling VFP2IISROOT.CREATEFORM(...) method or URL command http:// .../...?CMD=CREATEFORM
- For VFP controls "Control" you must provide your own code (HTML generation), because children of Control are inaccessible from VFP2IIS
- Check, if standard properties (especially visual like font...., position left....) of VFP are not hidden or protected. For some controls (Form, Grid ) VFP2IIS use additional properties (added during generation by VFP2IIS). Ensure that controls are not protected
- If you create form from class through VFP NEWOBJECT(.....), you must redirect to VFP2IISROOT.CREATEFORM(cName, cClass,cModule,cInApplication,...). Unlike desktop mode, you must include cModule and cInApplication with appropriate full path if needed .
You have application MYAPP.EXE with a class library MYCLASSLIB.VCX wich stores a class of form MYFORM. Inside your application in desktop mode, you can create form with one of following VFP commands:
x = NEWOBJECT("MYFORM", "MYCLASSLIB.VCX")
x = NEWOBJECT("MYFORM", "MYCLASSLIB.VCX",.null.)
or (if all is in MYCLASSLIB.VCX)
x = NEWOBJECT("MYFORM", THIS.CLASSLIBRARY)
VFP finds appropriate modules within the application. Because VFP2IIS is external of the application, VFP implicitly scans VFP2IIS for modules and does not find them. Therefore You must use one of next methods:
VFP2IISROOT.CREATEFORM("x", "MYFORM", JUSTFNAME(THIS.CLASSLIBRARY), FULLPATH("MYAPP.EXE"))
- For the same reason (VFP2IIS is external for application (APP, EXE)), you can not start compiled forms thru VFP2IIS. Forms are started in VFP2IIS with VFP command DO FORM ..., if this command is from application, form is found, but for external application is not know and found. You can:
In VFP9T are some inconsistencies (or bugs?) with passing value of inherited visual properties (e.g. backcolor of the form, Columnwidth in grid etc.) If this problem exists, set property explicitly in class or SCX
Another compatibility problems - see compatibility and known issues
- Exclude forms from project as standalone SCX ,SCT files and start with
- Save forms as class and start with
Note: if you use Component Gallery, you can expect more problems. Component Gallery contains many object based on unsupported VFP "Control" controls - principally not possible without changes in classes Transform Control to Container
Experimentation with own new form
Simply create your form (on base class or own class), try it in desktop and than start.
- under VFP create standard form with controls and data
- save form as SCX file in folder with VFP2IIS (e.g. as TEST.SCX)
- run IE and enter http://localhost/vfp2iis/default.asp?cmd=createform&class=test.scx
VFP2IIS_DEMO as example
Along with VFP2IIS, the VFP2IIS_Demo application is installed at the same time, and VFP2IIS.INI is configured to start VFP2IISDemo as default. You can start VFP2IIS_Demo in desktop mode or WEB mode and compare behaviours. For VFP2IISDemo is included source project to see some techniques. VFP2IIS Demo demonstrates base techniques and possibility of VFP2IIS. VFP2IISDemo include VFP2IISDEMO.VCX and VFP2IISBASE.VCX with definition new IExxx properties and methods used by VFP2IISDEMO.EXE under VFP2IIS.
Note: This VCXs are for DEMO application and classes and properties ARE NOT mandatory. VFP2IISBASE.VCX is example and has defined properties and method for easy demonstration of extended functions
If You want to see differences between WEB and Desktop handle (in source), you can find differences like - look for "_vfp.startmode" - if WEB requests special handle condition, _vfp.startmode=5 (#5 resp.) is used. Most WEB functions (generation, bind event and data handling) are controlled thru new properties and methods. Names of these properties and methods are prefixed IE.... - these properties and methods are used only if defined
Note: In VFP2IIS_Demo source is included class BAR (similar with Outlook Bar) supported automatic move panes and shortcuts, drag-drop moving and creating system shortcuts with drag-drop. This code is free, but not finished, documented and today no support from author.
From Desktop you can start VFP2IISDemo standard manner. In IE You can start VFP2IISDemo with :
or (if configured in IIS and vfp2iis.ini )
Experimentation with existing project
Best way for new application is create visual design with considering to WEB custom and possibility, under desktop debug, try and debug interface for WEB and (if required) insert conditionally code for desktop extension - menu, toolbar etc. (with IF _VFPSTARTMODE ....)
Note: for conversion existing project to WEB application under VFP2IIS you do not avoid learn some techniques under VFP2IIS - form refreshing etc.
If You want convert existing project to WEB, necessary steps are (according to restriction above) :
- scan project and exclude all compiled forms (SCX)
- change creating of form with use of VFP2IISROOT.CREATEFORM
- scan project for dialogs and modal state, insert code for handle
- messageboxes are supported, but need modify code
- for start of forms create common method
- for messageboxes create common method on the form and methods for handling returned value