Compaq Visual Fortran: A Guide to Creating Windows Applications

Chapter 3: User Interfaces

3.1 Interface basics

The three programs in Chapter 2 are sequential in operation. Once started, each program continues until it has finished execution of all its instructions. Such a program cannot be used again without exiting from the QuickWin interface and running the program again. By contrast, most Windows programs are event driven. That is, they present the user with a number of valid alternative actions and wait for the user to make a selection. QuickWin programs can also provide this level of choice to the user. This is achieved using a primary and secondary thread. Transparent to the user, QuickWin programs can cycle forever in a loop in the primary thread, while waiting in the secondary thread to respond to events such as the selection of a menu item or a mouse click.

The simplest method for setting up an infinite loop is to use a do-while statement, as shown below:

do while (.true.)   ! Wait forever in this loop to permit event-driven   ! action.   Call Sleepqq(500)end do

The user must exit from the program through an exit option in the application's menu. The subroutine SLEEPQQ will remove resource hogging by the do-while loop.

Rather than let the program cycle endlessly in a loop doing nothing, it is also possible to make the program wait in the loop until it receives user input (e.g., the click of a mouse or input from the keyboard). In either case, the additional code contained in the...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Embedded Programming Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.