Mastapp Sample Conversion


For the sake of simplicity some of the steps that were included in the previous practice run were not included here.

Preparation
Open the source project in Delphi's Demos\Db\Mastapp folder. Open only DataMod and no other forms of the project.

Change Database to the following properties with the path being valid for your system:

DriverName: INTRBASE  
 
SERVER NAME=C:\Program Files\Common Files\Borland Shared\Data\Mastsql.gdb  
USER NAME=SYSDBA  
PASSWORD=masterkey  

This change is being made because the MASTSQL alias is not installed on systems by default. It is auto-created if you run the MastApp application which is actually a Paradox application.

Quick Conversion
Get the tool GReplace I mentioned in the Converting To IBO Classes topic and run it. Please follow these steps in order to do the conversion:

·Open up the Mastapp.REP file in the TDatasetSamples folder of IBO.  
·Examine the Replace Text tab if you wish. It is setup with the necessary strings to completely convert this application.  
·Change to the Source tab and make sure that it is pointing to the right directory where Delphi is installed.  
·Change to the Destination tab and at the bottom of this tab is a button saying "GO". Click it.  
·Now open up in Delphi the project you just created in the TDatasetSamples\IBOMastapp folder.  

If you don't have this tool then you get to go through the DataMod unit in this project and do the search and replace manually in the DFM text and in the unit code. Please get the items you need to search and replace by opening that Mastapp.REP file in a text editor of your choice.

Getting to Compile Again
Iteratively compile and comment out or delete all lines of code that don't work until it compiles. Here's some of them that need to be removed:

In the DataMod unit:
Remove the entire SetDatabaseAlias(), UseLocalData() and UseRemoteData methods.

In the Main unit:
Remove the InitRSRUN procedure and all related references.
Remove the ViewLocalClick(), ViewRemoteClick() and ViewMenuClick() methods.
Remove all related menu items wrt. changing from local to remote.
Remove the CloseAllWindows and UpdateRSConnect() methods to avoid hints.
Remove the DataDirectory function as well.

Conclusion
You have now seen just how easy it is to convert a cached updates based application to IBO.

Other than changing class names only non-essential code had to be removed!

NOTE: This conversion guide was revised at IBO versions 3.6 and 4.0.