Deployment and runtime differences

Debug and deployment options

For a PocketBuilder project, you specify deployment options that are not available in PowerBuilder. You must select one of the following deployment options for each project: Desktop, Pocket PC Device (ARM), Smartphone Device (ARM), or any of the emulators that you have installed.

An application that you deploy to the desktop will look slightly different from the same application deployed to a PDA device or emulator. The desktop application has its own title bar with a maximize, minimize, and close button. Even if you select Close or SmartMinimize icons for a window, these do not display in the window when it is run or debugged on the desktop. Desktop deployment is for testing and demonstration purposes only.

When you debug an application, you do not have access to the Tip Watch or Quick Watch views that were added to PowerBuilder in version 9. You must debug an application from the PocketBuilder IDE; you cannot run the PocketBuilder debugger with a deployed application.

Running applications on an emulator or PDA device

PocketBuilder has a toolbar icon and Tools menu item that opens the Select and Launch an Emulator dialog box. You can use this dialog box to launch an emulator from a saved state or a cold boot.

You can download Pocket PC and Smartphone SDKs from the Microsoft Web site. These SDKs include emulators that you can use as target platforms for your PocketBuilder applications.

Using the Windows CE Start Menu

By default, PocketBuilder applications are deployed to the \Program Files directory of a Pocket PC device or emulator and to the \Storage\Program Files directory on a Smartphone device or emulator, but you can change the deployment directory in the Project painter. On a Pocket PC device, users can run the PocketBuilder applications you deploy by tapping on an application executable file in the directory where it is deployed. (You can also select a Project painter option to launch the application immediately upon deployment.)

Users can take advantage of the built-in PocketBuilder application list utility as a selection vehicle for deployed applications. However, you can also select a Project painter option to deploy an application shortcut to the \Windows\Start Menu\Programs directory on the Pocket PC or to the \Storage\Windows\Start Menu\Accessories directory on the Smartphone. That way users will be able to find the deployed applications quickly using the Start menu.

Using the built-in application list

Users can display the built-in application list by selecting PocketBuilder 2.1 from the Start menu. The list is empty until you begin deploying applications. By default, the application list displays executable files that you deploy to the \Program Files directory on the Pocket PC device or the \Storage\Program Files directory on the Smartphone. Users can launch any PocketBuilder application that you deploy to the device by selecting the application from this application list.

On the Pocket PC, the application list includes a directory browser that lets users select a different directory containing deployed applications. On the Smartphone, users can use the Menu soft key to change directories when browsing for deployed applications. However, on the Smartphone, it is not possible to browse above the parent directory of the application list utility, which is typically run from the \Storage\Program Files\ directory.

The application list is present on the device only if the complete PocketBuilder runtime package is installed. If you install only the PocketBuilder runtime DLLs to the device, the application list is not available.

Connecting to a SQL Anywhere database

By default, PocketBuilder runtime applications on the Windows CE device use the PKODB25.DLL dynamic link library to connect to SQL Anywhere data sources through the SQL Anywhere version 10 ODBC driver (dbodbc10.dll). You can specify a different ODBC driver by including the driver=dbodbcX.dll parameter in your DBPARM ConnectString assignment or in the file data source, where X is the version number of the ODBC driver for Adaptive Server Anywhere or SQL Anywhere.

For example, to use the Adaptive Server Anywhere 9 ODBC driver on the Windows CE device, you can use the following DBPARM:

SQLCA.DBPARM="ConnectString='DSN=myDSN;driver=dbodbc9.dll;UID=dba;PWD=sql'"
CONNECT using SQLCA;

SQLCA is the default connection object in all PocketBuilder environments.

In all runtime environments, the connect string for the DBPARM parameter must not include spaces other than those in the data source name (DSN). The DSN you assign must exist in the root directory on the Windows CE device or emulator.

When you install the complete PocketBuilder runtime package to the device or emulator (rather than just the runtime DLLs), the ASA 9.0 Sample.DSN file is added to the root directory. Instead of using the ConnectString DBPARM to set the driver name, you can modify ASA 9.0 Sample.DSN, or any other DSN file that you use, so that it includes an assignment for the database driver:

[ODBC]
enginename=asademo
databasename=asademo
databasefile=\Program Files\Sybase\ASA\asademo.db
start=\Program Files\Sybase\ASA\dbsrv9.exe
Driver=dbodbc9.dll 

If you are using the ASA Sample database that is migrated to SQL Anywhere 10, you can deploy the DemoDB_SA10.DSN file with your application. The PocketBuilder setup program installs this DSN file in the PocketBuilder Code Examples\SADemoData\SA10 directory. The DSN file sets the the databse file to \Program Files\SQLAny10\ASADemo_10.db, and the driver name to dbodbc.dll.

SQL Anywhere requires that DSN files be saved in ANSI format rather than Unicode format.

If you are running your PocketBuilder applications from the desktop, it is recommended that you use the actual name of the driver (for example, “Adaptive Server Anywhere 9.0”) in a ConnectString DBPARM rather than the name of the DLL. Otherwise, the driver you select in the connection string might be ignored.

Preventing the SQL Anywhere log screen from displaying

You can add a -qw switch to the start line in the DSN file to prevent the SQL Anywhere log screen from displaying when you connect to the database:

start=\Program Files\SQLANY10\dbsrv10.exe -qw

Because the connection might take a few moments, it is a good idea to call the SetPointer function to display the Windows CE version of the hourglass icon when using the -qw switch. For information about the use of SetPointer on the Windows CE platform, see the note on “Method limitations on Windows CE platforms” in this appendix.

CAB file creation and distribution

In PocketBuilder you can generate a CAB file with all the objects from a project and the project executable file. You can use the CAB file to distribute the project to multiple devices.

For more information about generating and distributing CAB files for your PocketBuilder projects, see Chapter 27, “Packaging and Distributing an Application.”

Resizing and moving controls

PocketBuilder painters do not allow you to set properties for resizing and moving controls at runtime. However, you can still give users the ability to move and resize controls by modifying these control properties in code.