Now you generate a MobiLink connection for the remote application using the MobiLink Synchronization wizard.
Select File>New.
In the Database tab, select MobiLink Synchronization for ASA.
Click OK.
Read the first overview screen and click Next.
Read the second screen to learn about what the wizard provides.
Click Next again.
Click Next to accept salesdb_tutorial.pkl as the default library for storing the generated MobiLink objects.
Select SalesDB_remote from the drop-down menu.
Click Test Connection.
A Connection successful message should display in the lower-left corner of the wizard page. If it does not, verify that the DSN is correctly configured in PocketBuilder and the ODBC Administrator. The ODBC Administrator is located in the Objects view of the Database painter in the ODB ODBC utilities.
Click Next.
Choose Browse and then select SalesDB_remote_10.DSN in the \Tutorial\SalesDB directory.
Click Next to display the wizard page showing publications in the remote database.
Select the salesapi publication and click Next.
Click Next to accept the default names for the generated MobiLink objects.
The default names are nvo_salesdb_tutorial_sync for the nonvisual object that will control the MobiLink synchronization client, and gf_salesdb_tutorial_sync for a global function that instantiates the nonvisual object and makes the call to launch a synchronization request.
After you click Next, the MobiLink Client Display Options page of the wizard displays.
In the Mobilink Client Display Options page, click Next to accept the default option.
The default display option causes the wizard to generate a synchronization status window named w_salesdb_tutorial_sync.
After you click Next, the Optional Runtime Configuration Objects wizard page displays. On this page, you specify names of wizard-generated objects that allow users to change synchronization settings at runtime. You can also intruct the wizard not to generate these objects. However, for this tutorial, you leave the default selections.
In the Optional Runtime Configuration Objects page, click Next.
You accept the default selection and instruct the wizard to generate synchronization objects that allow the end user to make runtime changes. The Override Registry Settings wizard page displays.
In the Override Registry Settings wizard page, keep all the default values and then click Next.
The MobiLink wizard stores synchronization information for each MobiLink user in the Windows registry on the device and on the desktop. The Override Registry Settings wizard page lets you specify how PocketBuilder adds or modifies registry settings when redeploying and configuring end-user applications.
After you click Next, the MobiLink Client Logging Options page displays.
Check the Show all except -vc and -vp (-v+) check box.
This wizard page determines the amount and type of information shown in the MobiLink status window during synchronization.
Click Next.
The MobiLink Client Additional Options page displays. It allows you to include additional MobiLink command line options or extended options and assign the MobiLink host and port. You must also select the MobiLink server version you want to use.
In the Extended Options text box, type the value lt=share.
Select 10 for the MobiLink server version.
Table-locking significantly reduces data transfer times, so for your application to function optimally, you set the LockTable (lt) options to share.
Click Next.
The last wizard page contains a summary of your choices, including the default selections. If you need to, you can go back and change any options that are incorrect.
Click Finish to generate the MobiLink synchronization components in your project.
The MobiLink Synchronization wizard creates the following synchronization objects:
Synchronization object |
Description |
---|---|
nvo_salesdb_tutorial_sync |
Nonvisual user object that controls the MobiLink synchronization client. |
gf_salesdb_tutorial_sync |
Global function that creates the user object and initiates synchronization requests. |
s_salesdb_tutorial_sync_parms |
Structure that stores the MobiLink command line parameters. (All the variables accessible from the wizard are MobiLink command line options.) |
gf_salesdb_tutorial_configure_sync |
Global function that handles a user request to change the synchronization options and stores the values in the Windows/Windows CE registry. |
The MobiLink Synchronization wizard also creates two windows:
Window |
Use |
---|---|
w_salesdb_tutorial_sync |
Displays the synchronization status information |
w_salesdb_tutorial_sync_options |
Sets synchronization options at runtime |
Now you enable the w_salesdb_tutorial_sync_options Sync Options window in the Menu painter.
Double-click m_salesdb in the System Tree to open the Menu painter.
In the Menu painter tree view, expand the File menu and double-click the Sync Options… menu item.
Check to be sure that the drop-down lists at the top of the Script view display the clicked( ) event for the m_file.m_syncoptions object.
If not, select that object and event from the drop-down lists.
Type the following code in script view:
// Open the Sync Options window gf_salesdb_tutorial_configure_sync() // Fetch data f_refresh_orders(-1)
Next, to enable synchronization when the user clicks Synchronize in the File menu, you add a call to the gf_salesdb_tutorial_sync global function.
In the Menu painter tree view, double-click Synchronize.
Make sure the drop-down menu at the top of the script view displays the clicked() event for the m_file.m_synchronize object.
Type the following code in script view:
// Start synchronization
IF gf_salesdb_tutorial_sync(string(::g_emp_id),"")<>0 THEN
MessageBox("Error"," MobiLink Synchronization Error.")
END IF
// Fetch data
f_refresh_orders(-1)
Select File>Save to save the changes.
Close the Menu painter.