Page 432
A system menu is usually linked to a startup application. This application is a nonbase table form used to set up the system. It contains the name of the menu used in the system, initializes the global variables used in the system, logs the operator on the database, and accepts security values from the operator. This application often has a photo image of something representative of the system's entity displayed on the startup canvas.
As an example of the preceding, the following will describe the development of a startup application for the Employee system.
NOTE |
Some of these steps are condensed since we have performed them in numerous examples in previous sections. |
FIG. 16.27
The Startup Application
canvas with the
imported image before
it is resized.
Page 433
FIG. 16.28
The Startup Application
canvas and the payroll
number and password
text items.
:global.payroll_number := :one.payroll_number;
This completes the Employee system. Figure 16.30 displays the startup form and the system menu. All system applications are now available from the menu.
NOTE |
The CD has the completed components of the Employee system. The startup application is called EMPSTART.FMX. It may be executed from Forms Runtime. |
Launching the Employee System from an IconThe Employee system can be launched by opening Forms Runtime and specifying the start up application, EMPSTART.FMX. However,
Page 434
the number of steps to launch the system can be reduced by creating a Windows icon to launch the system.
FIG. 16.29
The on-logon trigger
that logs the operator
into the Oracle
database.
FIG. 16.30
The Employee System
startup form displaying
the Employees menu
options.
The command line expression for the Windows icon consists of two parts. The first part of the expression launches Forms Runtime. The second part of the expression contains the name of the startup file. Figure 16.31 shows the command to launch the Employee system. It assumes Forms Runtime is loaded on the PC and the file is contained on the CD.
Maximizing the Initial ScreensWhen a form is initially displayed, it is presented in the normal Window size. This window size does not cover the entire screen. Because I design for
Page 435
a maximized screen, the window does not display the entire canvas. The operator needs to click the Maximize window icon to properly see the form. I generally correct for this problem by maximizing the window size for the startup application. Once the window is maximized, all other forms displayed will use that window size unless the Windows size is changed.
In order to maximize the window, create a form When-new-form-instance trigger that contains the statement shown in Figure 16.32.
FIG. 16.31
The command to a
launch the Employee
System from a Windows
icon.
FIG. 16.32
The command to
dynamically maximize
a window.
Calling Forms within the SystemThroughout this chapter there have been PL/SQL commands that call another form. In the references the file path was included. In the case of this
Page 436
chapter, the file path used in the examples consists of "d:", the assumed CD drive. These path expressions are hard coded into the application. Each form and menu in the system would need to be modified and regenerated with a new file path if the applications are moved to another location. Hard coding the file path also causes problems when the applications are distributed on different servers. The applications may reside on different directories on different servers. The developer would have to have a different set of applications for each server.
In order to overcome this problem, I populate a global variable with the file path used throughout the system. The global variable is populated in a When-new-form-instance trigger on the startup application. Each of the call_form commands in the system must be changed to include the global variable as part of the concatenated expression denoting the location of the called form. Following this approach, the developer will only need to modify the When-new-form-instance trigger of the start up application when the code location is changed. Figure 16.33 illustrates this syntax.
FIG. 16.33
The syntax of the
call_form command
using a concatenated
global variable as part
of the file path
expression.
NOTE |
The location of the menu module is hard coded in the start up form's Menu Module property. This technique will not work on that value. It must remain hard coded. |
Toolbars are graphical user interface (GUI) objects that allow the user to poke at an image or icon to perform an action. We have seen numerous toolbars in this part of the chapter. The Object Navigator, screen painter, and the property sheet each contain a toolbar. A form can also