IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Paradox
Search Paradox Group:

Advanced
-Collapse +Expand Paradox To/From
To/FromCODEGuides
-Collapse +Expand Paradox Store
PRESTWOODSTORE

Prestwood eMagazine

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

   ► KBDesktop Data...Paradox & Ob...ObjectPAL Co...Runtime, PDE...   Print This     
  From the June 2009 Issue of Prestwood eMag
 
Paradox Runtime, PDE, Package-It!:
Using Paradox 9's Application Framework
 
Posted 11 years ago on 5/31/2008 and updated 12/27/2008
Take Away: Getting started using the application framework in Paradox 9.

KB101144



The material in this article is from chapter 26 of my Paradox 9 book titled, Paradox 9 Power Programming: The Official Guide.

The Application Framework consists of an additional feature to the Project Viewer, a new Application Event Expert, an Application Menu, the Framework Launcher, and several special aliases.

Note: This article applies to Paradox 9 only. Since publishing this book, Corel has released versions of Paradox passed 9. Starting with Paradox 10, Corel removed the application framework from Paradox. Because the application framework is now a dead-end feature, I recommend you do NOT use it. If you choose to use the application framework, then upgrading your application to a later version of Paradox will be more difficult.

About The Application Framework

Versions of Paradox prior to version 8 had a major problem, there was no easy way to create global menus. Imagine you've created your opening form to your application and you've put a menu that will open up other forms. The problem is that the control for the menuAction event is in your opening form and will have to be duplicated in every form you wish to use the global menu. A good solution to this particular problem is to pass the eventInfo to a library routine and let it handle the menu processing. This means adding code in the menuAction event of every form that uses the menu. The Application Framework solves this problem by implementing this technique for you. That is just one example and there are many more that you'll discover as you explore the Application Framework.

Exploring the Application Framework

Perhaps the best way to learn about the Application Framework is to jump right in and explore its capabilities. In this section, you'll create a new Application Framework application and explore the default .EXE, .INI, aliases, script, forms, tables, libraries, and menus that are automatically created for every Application Framework application.

Creating an Application Framework Application

The following steps document how to create a new Application Framework application.

Step-by-Step

1. Open the Project Viewer and select the Applications icon.

2. Right click on the Applications icon and select New (see figure 1). The New Application dialog box displays.

Figure 26-1: Creating an Application

1

3. Specify the values in the New Application dialog box (see figure 2). The folder you specify must NOT already exist. Paradox creates it for you.

Figure 26-2: Specifying Name and Folders

2

You have just created your first Application Framework application that is now ready run. Granted, it's just a shell of an application, but it is a complete application.

Running your application from the development environment

Running an Application Framework application from the Development Environment is easy, but before we do that, let's set some application level parameters. Using the Project Viewer, select the Applications icon and set the Author Company, Author Copyright, Author Name, Author Version, and Description (see figure 3 for an example).

Figure 26-3: Specifying application parameters

3

Run the application by selecting the Run Application icon (see figure 4).

Figure 26-4: Running your application

4

Notice that the application title, splash screen, and the Help | About dialog box automatically use the application level data we entered.

Running your application outside of Paradox

The nice thing about the Application Framework is that it sets up your application ready to run outside of the Paradox environment. Your application still requires Paradox, but it feels more like a regular Windows application than traditional Paradox applications do. To see what I'm talking about, exit Paradox, open the Windows Explorer and double click on the .EXE you created above (C:\People\People.exe if you followed the screen shots above).

Default script

In the root folder of the application is a default script created by the Application Framework. This script is called by the EXE.

Reopening your application in Paradox

To reopen an Application Framework application, open Paradox and from within the Project Viewer, select your application. All the Application Framework applications are grouped together and bracketed (see figure 5).

Figure 26-5: Framework applications are grouped and bracketed

5 

Framework Aliases

The Application Framework creates several aliases for use with your application. These aliases allow you to easily manage all of the objects required for your application. Table 26.1 lists the aliases.

Alias

Description

exe

Points to the executable folder, which contains the .EXE and .INI files, and the startup script for an application.

app

Points to your application folder, which contains all of the code used by your application. This is where you place all of your application objects (forms, reports, libraries, and scripts).

appTables

Points to the application tables folder, which contains all of the code-related tables used by an application.

fwTables

Points to the Application Framework tables folder, which contains all of the tables shared across applications.

fw

Points to the Application Framework folder that contains all of the code shared across applications.

tables

Points to the tables folder, which contains all of the data tables used by an application. This is where you put your data.

Table 26.1: Framework Aliases

In general, DO NOT modify the files in the appTables, fwTables, or fw aliases directly. Only use the various interfaces provided by the Application Framework. The two aliases you will use most in your code are the app and tables aliases.


Default Forms

All of the default forms the Application Framework creates are located in the fw folder. Feel free to alter any of them but keep in mind these forms are common to all application you develop. Table 26.2 lists the default forms.

Form

Description

appAbout.fsl

Your Help | About dialog box for this application. Feel free to modify this form to your hearts delight.

appDesk.fsl

This form file contains the Desktop form (main window) used by your application.

appmap.fsl

This form file contains the map form used by the application. A map form contains a series of buttons that open forms and reports in the application and is a shortcut to using menus. When you close the default map form, you close your application.

appsplash.fsl

This form file contains the splash screen used by the application. The splash form is not an Application Framework form. Therefore, it doesn't contain all of the form-level code that integrates a form with the rest of the Application Framework.

fwerr.fsl

Your error dialog box.

Table 18: Application Framework forms

Application Framework Coding Levels

The Application Framework adds two coding levels above the traditional Paradox application: the application and framework levels. The code for these two levels are stored in traditional ObjectPAL libraries. To access both the application and framework levels, use the Application Event Expert available by selecting Tools | Application Event (see figure 6).

Figure 26-6: The Application Event Expert

6

The application level is used for code that you want to apply to all objects within this application, but to only this application. Application level code is stored in the :app:app.lsl and :app:apptools.lsl libraries. These two libraries are created in the app folder for every Application Framework application you create.

The framework level is used for code that you want to apply to all Application Framework applications you develop. Framework level code you create is stored in the :fw:fw.lsl and :fw:fwglbl.lsl libraries. These two libraries are in the fw folder and there is only one fw folder for Paradox. Also included in this folder are several delivered ObjectPAL libraries that are used with the Application Framework and because they are delivered, you can't modify them.

Using the Application Event Expert

To add code to an event at the application or Framework level, select Tools | Application Event. The Application Event Expert displays. Select which event you wish to alter (see figure 7) then press Next.

Figure 26-7: The Application Event Expert

7

Next choose if you want the event to execute in all forms in all applications (the highest level), all forms for the current application (global to the application), or only for the specified form (see figure 8).

Figure 26-8: Specifying Level

8

When you click Finish, the ObjectPAL Editor will be opened to the correct event or method.

Application Framework menus

Figure 9 shows the Application Menu dialog showing the File | Exit option. This dialog manipulates tables in your appTables folder. By default, the Application Framework creates three menus. The App menu is used while no forms or reports are specified or if you choose not to display either the Form or Report menu. The Form menu is merged with the App menu when a form is displayed and the Report menu is merged with the App menu when reports are displayed. Forms and reports have a Menu property where you can specify which menu will be displayed when the object is selected from the menu. When adding options pay particular attention to the Merge ID property. The Merge ID determines the location of the option when the menu is merged.

Figure 26-9: The Application Menu

9

Upgrading from non-framework applications

Unfortunately, there isn't an automatic way to upgrade your Paradox forms and reports to use the Application Framework. You could simply add them as a menu option but you will not get all the default code. The only way to get the default code in your existing forms is to create a new Application Framework, then recreate your forms, reports, libraries, and scripts within it. Although you do have to recreate them, you don't have to start over. Here are sure-fire procedures for moving objects into a new Application Framework.

Importing Tables

Your tables don't need to change. If you used an alias to refer to them, then just keep using the alias. If you left them in the same folder as your forms and reports, then move them to the app folder (the folder titled app that the Application Framework created as a subfolder to the base folder you chose).

Importing Forms

Here is the procedure I use to move a form to the Application Framework.

Open the old form and save the data model in the new app folder.

Create a new form in the Application Framework using the data model you saved in step 1 (a .DM file).

Copy and paste the page(s) from the old form to the new form.

Merge the old form level code (events, methods, and properties) with the default form level code added to your new form by the Application Framework.

Note You may wish to open two instances of Paradox in order to make copying and pasting easier.

Another technique is to simply add the needed code to your existing forms. All framework forms have the same default methods and declarations at the form level. You can copy the following events from a framework form to the old form. Then manually add the form to the menu.

  • TYPE
  • USES
  • VAR
  • MENUACTION
  • OPEN

Summary

The Application Framework allows you to create Windows applications that look and feel like other Windows applications. Just as Visual Basic requires various DLLs, your Application Framework applications still require Paradox. You can distribute your applications with the full version of Paradox or just the runtime. If you use the Paradox Distribution Expert (PDE) which comes with the Paradox Runtime, your applications will be compressed and install with a slick installation program custom created for your application.

Linked Message Board Threads

 Print report from App Framework application in Application Framework MB Topic (2 replies)
 How to keep a form open? App Framework in Application Framework MB Topic (8 replies)
 Problems with Application Framework in Application Framework MB Topic (2 replies)
 Application Framework -- Modifying existing form o in Application Framework MB Topic (1 replies)
 Application Frameworks in Application Framework MB Topic (4 replies)
 Delivered Objects and FrameWork in Application Framework MB Topic (1 replies)
 AF in Application Framework MB Topic (1 replies)
 Application Framework And PDE in Application Framework MB Topic (2 replies)
 App Framework Question - Can no longer add a form in Application Framework MB Topic (0 replies)
 Application Framework: I don't get it! in Application Framework MB Topic (8 replies)
 Application Framework Distribution in Application Framework MB Topic (1 replies)

Comments

0 Comments.
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 = P1164A1
Enter key:
Article Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101144 Counter
7972
Since 5/31/2008
-
   Contact Us!
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


Go ahead!   Use Us! Call: 916-726-5675 


©1995-2019 Prestwood IT Solutions.   [Security & Privacy]