Copyright (c) 1991-1994 Borland International, Inc. All Rights Reserved. This document describes the sample program files, which are installed in the SAMPLES subdirectory. Several programs use the dBASE for Windows Form syntax, which lets you run multiple programs simultaneously. For example, start openform.prg by either typing DO OPENFORM in the Command window or double-clicking on its icon in the Navigator. After the openform form appears, you can start Winapi.wfm again either through the Command window or Navigator. You can then switch freely between the two forms. All samples should be run from the <_dbwinhome>\samples directory. There is a SAMPLES.CAT catalog that lists all the samples files described below. Note: The files in the samples\extern, and samples\music directories are described in extern.txt, and music.txt, which are located in the corresponding diretories. ANIMALS.WFM ----------- Files used: ANIMALS.DBF, ANIMALS.DBT, ANIMALS.QBE, ANIMALS.MDX BUTTONS.CC This program shows how the dBASE for Windows form controls defined on database fields are related and change as the record pointer changes. It also displays imaging commands. The image displayed is stored in a binary field in ANIMALS.DBF. An animal's size will turn red when that animal has a size of > 10. You can type "Do animals.wfm" in the Command window to run this file, and then click the Design SpeedBar button to design it. Alternatively, in the Navigator, you can select the Forms icon, and right-click the icon for ANIMALS.WFM to SpeedMenu where you can choose an option. You can then select Design Form to design the form. When you want to run the form, click the Run (lightning bolt) SpeedBar button. BINTREE.PRG ----------- File used: CLIENTS.DBF This program shows how you can use the dBASE object extensions to create a binary tree. It builds a tree of client names, from CLIENTS.DBF, in alphabetical order. The tree goes left to right alphabetically, for example, left child, parent, right child. BUTTONS.CC ---------- This is a procedure file containing custom control classes for dBASE forms. You can use the controls in this file by issuing a SET PROCEDURE TO within your program, and then using the custom controls as you would any built-in ones as in: DEFINE CANCELBUTTON C OF THIS.... If you have this procedure file loaded before opening the Form Designer, the custom controls defined in it will appear in the Control Palette under Custom. You can then add these controls to your form visually and modify their properties in the Object Inspector and the Procedure Editor. CAL.WFM ------- This is a simple calculator form. It allows mathematical calculations, memory manipulations, and hex/decimal conversions. The results appear in the display entry field at the top of the form. The memory value appears in the memory entry field at the bottom of the form. You can modify and inspect this form through the Form Designer. CHANGDIR.PRG ------------ File used: BUTTONS.CC CHANGDIR.PRG is a tool for changing directories. It allows you to traverse a directory tree, select a directory and either change directories to the one you seleted (by pressing the OK button), or cancel the program (by pressing the Cancel button). CONTACT.WFM ----------- Files used: COMPANY.DBF, CONTACT.DBF, CONTACT.DBT, CONTACT.MDX, CONTACT.QBE, COMPANY.DBT, COMPANY.MDX BUTTONS.CC This program relates 2 tables and shows how form controls work together and change as the record pointer moves in the main table. It defines a form with a list box containing the names of companies, radio buttons with company types, an entry field showing the contact for the current company (from the contact table),and an editor showing notes for that contact (also from the contact table). The Close push button closes the form. CONTACT.WFM can be modified through the Form Designer. CUSTOMER.WFM ------------ Files used: CUSTOMER.DBF, CUSTOMER.DBT, CUSTOMER.MDX, CUSTOMER.QBE, ORDERS.DBF, ORDERS.QBE, CUSTOMER.MNU, DIVESHOP.BMP, BUTTONS.CC This is a form that shows information about different customers in a company. It also illustrates how you can use transactions in a dBASE form. You can move through the existing customers by selecting the Next/Previous buttons, Cancel to leave the form, or edit the information about the current customer. You can look at the form in two modes -- View or Edit. Initially the form is in View mode, which doesn't allow editing of information. To change to Edit mode, choose Customer|Edit from the menu. Changing information in Edit mode, and moving to another customer will display a dialog box, which asks if you want to save the information you just changed. You will not see this dialog box when moving between records in View mode. This form contains a menu that allows adding or deleting a customer and searching for a customer based on the NAME index tag. DBCLOCK.PRG ----------- Files used: DBTIMER.VBX, DBCLOCK.BFM This is a simple clock program. It brings up a form with a time display. The time display changes size as you resize the form. It will always be centered in the form. There is also a menu that allows changing the font and color properties of the time display, as well as the format of the displayed time (12/24 hour). EQUIPMNT.WFM ------------ Files used: EQUIPMNT.WFM, GETFLTS.WFM, CHANGEQ.WFM, EQUIPMNT.QBE, CHANGEQ.QBE, FLIGHTS.DBF, FLIGHTS.MDX, AIRCRDB.DBF, AIRCRDB.DBT, AIRCRDB.MDX, EQUIPMNT.MNU EQUIPMNT.H, AIRBRLND.BMP, AIRBRLN2.BMP Note: There is also an EQUIPMNT.CAT catalog that lists the above files. This is an application that lets you change airplanes for different flights of the Airborland airlines. It brings up a form with a menu that lets you select the flight for which you want to change the equipment. After you select the flight, you will see a browse of all flights corresponding to your selection, an image of the plane used for the flight currently highlighted in the browse, and a button you can press to actually change the plane. Pressing the Change Equipmnt button displays another form with a list box of different plane names and the image corresponding to the selected plane type. You can select an airplane from here, and the current flight will be modified to use the new plane. To exit the program, choose File|Exit. EVENT.PRG --------- This is a program that shows how you can use the different event handlers attached to a form to detect combinations of mouse and keyboard key presses. It displays two forms. One of them you can resize by dragging the mouse -- the form will follow (without you having to drag the border). The other one lets you create as many buttons as you want, move them around and align them by combining different key click combinations. FONT.WFM -------- Shows how to set different fonts and colors for the form controls. Fonts can be set for all the form controls. LINKLIST.PRG ------------ This is a simple program that creates a linked list of integers from 1 to 10. Each link has a value and next properties. After the list is created, a function is called to step through it and display the contents of each link. NAMEINFO.WFM ------------ Files used: NAMES.DBF, NAMES.DBT, NAMES.QBE, NAMESRCH.WFM BUTTONS.CC This program shows dBASE for Windows' DDE capabilities. It establishes a link with WordPerfect to create a "Thank you" letter for customers that had purchased software. OPENFORM.PRG ------------ Files used: COUNTRY.DBF, COUNTRY.DBT, COUNTRY.MDX, BUTTONS.CC This program shows how the OPEN FORM command works. OPEN FORM displays a form and enables the controls contained on that form. It does not stop program control flow. In this program, you can select a country in one form, then view information about that country in a second form. You can then select more countries from the first form, and display forms with information about them. All information forms remain onscreen until you close them. ORDERS.WFM ---------- Files used: ORDERS.QBE, ORDERS.DBF, ORDERS.MDX, LINEITEM.DBF, LINEITEM.MDX CUSTOMER.DBF, CUSTOMER.DBT, CUSTOMER.MDX, ORDERS.MNU, DIVESHOP.BMP, BUTTONS.CC This form displays information about a customer order. It uses a format similar to Customer.wfm. It has buttons that let you move around in the Orders table. The Orders table is related to the Customer and Lineitems tables. Each order could have many line items ordered. These items are displayed in a browse control on the form that changes as you move through the orders. There is also a customer number displayed for each order. There is also a menu attached to this form through which you can add or delete an order, or search for an order based on the current index, order_no SEARCH.WFM ---------- Files used: BUTTONS.CC This is a generic search form that allows you to enter a value, and then save it by pressing Ok, or ignore it by pressing Cancel. The value is saved as a property of the form, so that the form calling Search.wfm can search and perform some action based on the value. SWITCH.WFM ---------- Files used: SWITCH.VBX, SWITCH.BFM This form illustrates how to use VBX controls in dBASE forms. It displays a simple two-state switch that changes the color of the form and the caption of the switch control when it's turned on or off. PICTURES.WFM ------------ Files used: PICTURES.DBF, PICTURES.DBT, PICTURES.MDX, PICTURES.QBE Note: All ole field values contain embedded data. Windows saves the full path with each linked file, so only embedded data can be used if the files are to be portable. This program shows how the form controls defined on table fields are related and change as the record pointer changes. It also shows how you can view OLE fields in dBASE forms. A form is defined with a list box of image names and an OLE control containing an image you can modify through Paintbrush. The OLE control corresponds to the currently highlighted name. There is also a sound button that will play a sound corresponding to the image. Both the OLE image and the sound are stored in binary fields in Pictures.dbf. Double-clicking on the OLE control allows you to edit it through Paintbrush. You can use the Form Designer to modify and run this form file. WINAPI.WFM ---------- Files used: SYSINFO.WFM, BUTTONS.CC Calls: GetVersion(),GetWinFlags(),GetModuleUsage(),GetModuleHandle(), ShowWindow(),GetFreeSpace(),messagebox(),SystemParametersInfo(), GetWindowText(),CloseWindow(),OpenIcon(),GetWindowsDirectory(), GetPrivateProfileString() (external functions) This program gives extensive examples of how you can use the API interface to access Windows functions and obtain useful information. It displays a form that lets you select what external functions or groups of functions you would like to execute, and then executes your selection. You can get various types of system information, display Windows dialog boxes, minimize or maximize dBASE windows, and much more.