DataWindow controls

The DataWindow control is a visual container for DataWindow objects in a PocketBuilder application. You can use it in a window to present an interactive display of data. The user can view and change data and send changes to the database.

The DataWindow supports data retrieval with retrieval arguments and data update. You can use edit styles, display formats, and validation rules for consistent data entry and display. The DataWindow provides many methods for manipulating the DataWindow, including Modify for changing DataWindow object properties.

You can share a result set between several DataWindow controls and update databases on Windows CE devices or on the desktop. Using Mobilink—a database synchronization tool that comes with Sybase SQL Anywhere Studio—you can synchronize data between a client database on a Windows CE device and a server database on the desktop.

Development environment

You add DataWindow controls to windows or visual user objects in the Window or Visual User Object painters. The DataWindow control is in a drop-down palette of controls on the PainterBars for these painters. After you add the control to the window or user object, you can associate a DataWindow object with it in the painter.

You write scripts that control the DataWindow’s behavior and manipulate the data it retrieves. The DataWindow object associated with the control determines what data is retrieved and how it is displayed.

You can use the Browser to examine the properties, events, and methods of DataWindow controls on the System tab page. If you have a library open that contains DataWindow objects, you can examine the internal properties of the DataWindow object on the Browser’s DataWindow tab page.

Database connections

The DataWindow uses an SQL Anywhere ODBC database driver or an UltraLite database driver for database connectivity. Users can connect to a data source on their Windows CE devices and make updates to those sources.

To make a connection, you can use the internal Transaction object of the DataWindow, or you can make the connection with a separate transaction object.

PocketBuilder provides a default Transaction object, SQLCA; you can define additional Transaction objects if you need to make additional connections. When you connect with a separate Transaction object, you can control when SQL COMMIT and ROLLBACK statements occur, and you can use the same connection for multiple controls.

For more information about using a Transaction object with a DataWindow, see Chapter 9, “Using DataWindow Objects.” For more information about Transaction objects, see Chapter 16, “Using Transaction Objects.”

Coding

You write scripts in the Window or User Object painter to connect to the database, retrieve data, process user input, and update data.

To take advantage of object inheritance, you can define a standard visual user object inherited from a DataWindow control and add your own customizations. You can reuse the customized DataWindow control in multiple applications.

You can also create a customized version of a DataStore object. You create DataStore objects—the nonvisual version of a DataWindow control— in scripts. For more information, see Chapter 11, “Using DataStore Objects.”

Libraries and applications

You store DataWindow objects in PocketBuilder libraries (PKL files) during development. When you build your application, you can include the DataWindow objects in the application executable or in PocketBuilder dynamic libraries (PKD files).

For more information about designing DataWindow objects and building a PocketBuilder application, see the User’s Guide.