I.T. Discussion Community!
-Collapse +Expand
Search Paradox Group:

-Collapse +Expand Paradox To/From
-Collapse +Expand Paradox Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBDesktop Data...Paradox & Ob...Interactive ...   Print This     
  From the October 2015 Issue of Prestwood eMag
Interactive Paradox: Forms:
Paradox Forms From Scratch
Posted 10 years ago on 5/12/2008
Take Away:

Be Your Own Expert! Form building techniques.


Paradox contains several ways to make form creation easy.  If you select "Forms, New" you will be presented with three action choices: Blank, Expert, and Data Model.  Either of the last two of these will guide you to creating a workable form.  It may not be the prettiest, but with the help of the alignment and property tools in the Paradox form designer you can spiff it up.  There is one drawback: experienced Paradox developers have found those forms lacking in several respects for use in programmed applications.  The main failings of the "experts" are no use of database aliases and limited use of table aliases in data model design, and placing bare fields on forms.  The purpose of this article is to help you use the "Blank" option to easily create a form from scratch that will be ready for any programming you may add down the line, and ready to be a robust and portable part of a complete Paradox application.  This may seem overwhelming on your first time out, but the preferences steps only need be done once, alias definition once per application, and the actual form design steps take longer to explain than to do once you've walked through them a time or two.


Before clicking on that "Blank" button, we need to make sure the blank that Paradox pops up won't overwhelm our screen workspace.  To do that go to the menu "Tools, Settings, Preferences", and open the Forms / Reports tab.

Note: the menu sequences here are for Paradox 9; whatever version, once you get to the Preferences dialog it's pretty standard.

Unclick the "Size to desktop" checkbox in the On-screen size section, choose the "Pixels" radio button, and enter Width and Height values that will fit your desktop with some room to spare.  I find 500 x 400 works well for me.  IF you leave "Size to desktop" checked, the form will more than fill the Paradox desktop and will have scrollbars and you'll have a hard time getting to the page corner to size it smaller.  It's a lot easier to make it bigger when you need to.

While we're in the Preferences dialog, let me mention a couple other settings that I've found make designing forms a little easier, and will take up less workspace real estate (always a scarce commodity):

- On the Designer tab, uncheck all the ruler boxes.
- On the Advanced tab, uncheck "Use scroll bars in form windows by

Go ahead and tell the dialog box OK.


Now we have one more essential task before we're ready to create that blank form:  we need a database alias.  Aliases in this sense are essentially shorthand for a particular drive and path where table, forms and other Paradox objects can be found.  They also make it easy to move Paradox applications.  If we always use aliases to refer to the path to tables and other objects, all we have to do is redefine the aliases and instantly all the references to them point to the correct new paths.   We'll use a simple example, an invoice application for ABC Company, with a single database directory containing all the forms and data called "ABCINV".  Create a directory somewhere (perhaps in D:\APPS?) and call it ABCInvoices.

You might want to have separate directories for data and forms and reports, but a discussion of the pros and cons of alias setup if a matter for another article.  If you want to find more on the subject, try the Google usenet search tool at <http://groups.google.com/advanced_group_search>. 

NOTE: do NOT use the "WORK" alias; it only points to the current Paradox working directory, and we want our form to be independent of that.  Select "Tools, Alias Manager...", press "New", uncheck the "Public alias" box, and enter ABCINV as the "Database alias".  Go to "Path" and enter the path or use the "Browse..." button to select the path.

OK: now we can select "Forms, New, Blank", and there is our blank form design window.  Pretty bare, hunh?


  Selecting Tables by Database Alias

From the main menu define the form's data model: "Format, Data Model...".  We want to select the application alias BEFORE we select any tables for the data model.  [d_rop]down the Alias list(in Paradox 9 it's a [d_rop]down box just above the list of tables, and shows "WORK" by default) and select ABCINV.  Again: do NOT use the "WORK" alias.

Now select the tables: we'll be using the Invoice.db, LineItem.db, and Customer.db tables.  In the data model dialog in Paradox 7 and 8 the path or alias to the current table object would show in a text box above the
dialog linking window.  This very useful information is missing from the data model dialog since it was "improved" for Paradox 9; we hope to see it back in a future version.  In Paradox 9 or 10, if you have the status bar turned on, the path to the object appears as a message.  The alias does not show, but so long as you select a database alias and then select the tables, it will work correctly even though you cannot see it

  Assigning Table Aliases in the Data Model

Once the tables have been selected we need to assign table aliases to them.  A table alias is a little like a database alias: it serves as an independent reference to a table included in the data model, and can make it much less painful to change tables in a form of a copy of a form.  In Paradox 9, right click on a table object in the data model window, select "Table alias...", and type in the alias.  I make it a practice to use the table name in ALL CAPS, but you can select your own style.  Now we have table objects labeled "INVOICE", "CUSTOMER", and "LINEITEM".

      Example Table Structures

INVOICE.DB                         Sec Index?
------------------------------     ----------
InvID                      I*
InvDate                    D
CustID                     I       yes
LINEITEM.DB                        Sec Index?
------------------------------     ----------
ItemID                     I*
ItemSeq                    S
InvID                      I       yes
SKUID                      I                   <- lookup to STOCK.DB PriceEach                  $
Qty                        N
CUSTOMER.DB                        Sec Index?
------------------------------     ----------
CustID                     I*
CustCompany                A60     yes
CustLast                   A20     yes - composite [w/ CustFirst]
CustFirst                  A20      "        
CustAddr1                  A40
CustAddr2                  A40
CustCity                   A40
CustState                  A2
CustZip                    A10
... etc.

   Linking Tables in the Data Model

Link the tables by clicking and dragging from the linking field in one table to the linking field in another.  In our example, INVOICE is linked 1 to Many by InvID (its primary key field) to a secondary index on the field
InvID in LINEITEM (its primary key field is ItemID).  Tnis is called "foreign key linking"  -  the InvID field in LINEITEM is a "foreign key" telling us what INVOICE record the line items are related to.  We also want
to link the INVOICE CustID field 1 to 1 by CustID to CUSTOMER (its primary key field) so as we scroll from invoice to invoice we can show the related customer information.

Press OK to exit the dialog.  You do not need to press "Save DM" unless you want to create a .DM file; it's not necessary to the form design, and I rarely find them of use, but that's up to you.


At this point our form is still a blank box, but it would be a good idea to save it.  I'm going to call it INVOICE.FSL.


We want our form to show a one invoice at a time, to show all the lineitems related to that invoice in a scrolling area, and also to show the name, address and phone number of the customer the invoice is identified to.  In a form created by one of the Paradox "experts" the master table (probably table aliased by the relatively uninformative "MASTER", and NOT defined from a database alias) will have fields placed right on the page.  This is what we mean by "bare fields"  -  there is no table display object to intercept table and record level events, so they have to be handled more clumsily and  less robustly at the form or field level.  By 'table display object' we mean one of the two types of objects that display tables, either a multiRecordObject ["MRO"] or a tableFrame.  To display a single record of a master table the usual practice is to use an MRO with its record layout set to 1 across by 1 down.  This is sometimes called a 1x1 MRO or even an SRO ("single record object").

Click the MRO tool on the form design toolbar and drag out a rectangle across the top third of the form.  Leave a little extra space on the right if you'll be wanting a vertical scrollbar on the ui object.


Right click on the MRO and choose "Define Record".  Select the INVOICE table and the fields you want displayed  -  you can start with just one field, then adjust its properties (labeled or edit? color, frame, text characteristics, font face, size and color, etc.) to what you want.  Then you can duplicate it (choose "Edit, Duplicate"  -  or press AltE, E, and Enter**) as often as you need, and define the fields, and modify the properties of the copies as you need.

When you define the record (table) the MRO will take the same name as the table alias from the data model, so the object name property should be INVOICE.  I find this makes code easier to read later on.

** [AltE, U in v. 8;  AltD, D in v.7  -  just when you get used to the interface someone "improves" or "standardizes" it or makes it "more suite compatible" or "accessible"]

   The CUSTOMER field or MRO

You can create a small 1x1 MRO to display the Customer name info, but you  can also just place another field inside the INVOICE MRO record and define it as CUSTOMER."CustCompany", or make it a calculated field concatenating the first and last names, etc., as you like.  If you make a small MRO it can be within or without the INVOICE MRO;  see Dennis Santoro's excellent article on containership in Paradox forms at his web site <www.rdaworldwide.com> for more info on where to put it and why.

   The LINEITEM tableFrame

Click the tableFrame tool on the form design toolbar and drag out a rectangle across the bottom half of the form.  Leave a little extra space on the right for a vertical scrollbar.  NOTE: wide scrollbars are more in accord with standard Windows form design  -  and easier for some users to click on.

You can choose only one or a few fields;  I recommend avoiding large alpha fields and memo fields as they tend to come on screen several rows deep.  You can always add columns (fields) to a tableFrame later:  click on any
row below the first row, and when the column is selected press Ins;  or Del if you want to remove a column.

I usually use a "Single" line grid property, and turn on record dividers, but the "3D" and "None" properties are sometimes useful.  The "Double" and "Triple" style grids look like leftovers from a DOS spreadsheet, but feel free to make the form as ugly as you like <ducking and running>.  While we're on the subject of "ugly", try to restrain your use of color.  Too much of it is tiring to users and it loses its impact when you WANT to call attention to a field or text label or such.

[See "About Face: The Essentials of User Interface Design" by Alan Cooper (a good guy, even if he did work on Visual Basic for The Evil Empire), copyright 1995, IDG Books, ISBN 1-56884-322-4;  for good design tips;  for some frequently hilarious and/or maddeningly BAD examples, go to the Interface Hall of Shame at <http://homepage.mac.com/bradster/iarchitect/shame.htm>]


You're done with the basic design.  At this point you should have a workable 1-Many form to show INVOICES and their LINEITEMS, as well as translating the invoice customer to an actual name.  If and when you add some code to the form (perhaps for custom lookups, or line item sequence numbering and renumbering  -  possible article topics) move it to another computer, or move your application to a different directory on the same computer, it will be easier to modify and more robust than the products of the built-in expert dialogs.


TIP:  you can Control-click multiple objects, right click on the selected objects, and then set many common properties at once.  One way to select a number of objects at once, such as all the fields in a record, or all the text objects in a tableFrame header, click on the container (for example, the header), choose "Edit, Select all", then right click on the collection to set common properties.

TIP:  keyboard shortcuts for aligning objects on a form or report:

  Menu Key*  Function                          Shortcut Key[s]
  --------   -------------------------------   ---------------
  Alt-M     &Group  (toggles Group/Ungroup)        G
            &Order  Bring to &Front                O F
                    Send to &Back                  O B
                    &Align    Align &Left          A L
                              Align &Center        A C
                              Align &Right         A R
                              Align &Top           A T
                              Align &Middle        A M
                              Align &Bottom        A B
                    &Size     Minimum &Width       S W
                              Ma&ximum Width       S X
                              Minimum &Height      S H
                              &Maximum Height      S M
                    Spa&cing  &Horizontal          C H
                              &Vertical            C V

* Alt-M for forMat; Alt-D (for Design) in earlier versions

  The letters preceded by the ampersand [&], "O F", etc. are, of course, the "hot keys" that you press after Alt-M.  Multiple object selections are required, of course (except for unGroup).


Share a thought or comment...
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1222A1
Enter key:
Article Contributed By Steve Caple:

Steve Caple I first saw Paradox in 1985 when a guy named Rick Albers came to demo Ansa's new 1.1 release to the Sacramento PC Users Group. The feeling was like going from WordStar to WordPerfect 3.0, a sense of freedom and power.

A long time dBase user had an evaluation copy he let me use for a few weeks.  Going from dBase to Paradox was like finding yourself walking WITHOUT your shoe laces tied together.  I was hooked; within a week I wrote my first useful Paradox DOS program.  It took a few evenings to put together a script to  generate a Basic Bulk Mail sort,  using a series of Paradox queries against a bicycle club Century ride mailing list.  It then used PAL to send text to the printer, printing it out in 5 digit Zip, three digit Zip, and miscellaneous by state groups, including group header labels and spacers on one-across stock  -  just tear it apart at the headers and give it to the mailing volunteers, and a job that used to take 20 people 4 or 5 hours could be done by 5 or 6 in a single hour.  

Later, Paradox for Windows version 5 added many needed structural and indexing and linking features, and as hardware caught up with the needs of a GUI environment it became a powerful database for small companies and divisions or branches within large corporations.  Despite some years of no real changes it remains one of the best products for that purpose.

Visit Profile

 KB Article #101042 Counter
Since 5/12/2008
   Contact Us!
PrestwoodBoards.com was developed and is maintainted by me. Do you have a question or suggestion? Do you see a problem? Contact me now. My goal is to build an ad-free and spam-free source of I.T. information with many contributers (ok to promote your website/company in your bio). Yes, my company Prestwood IT Solutions is mentioned in my bio which shows with every post, but you can contribute and promote your pet project too!

3,774 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...

©1995-2018 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech