ActiveField™ Help

Main QuickField Site     Free Downloads     Contacts

ActiveField Technology
What's New
Objects Overview
Hierarchy Chart
How to Start: Application Object
How to work with Problems
How to work with Model
How to work with Data
How to Analyze Results

Objects

Properties

Methods

How to Start: QuickField Application Object

Here we begin to discuss how to write a program using the QuickField Object Model. We will illustrate the discussion with examples in Microsoft Visual Basic, a language likely to be used by many developers to access to the Automation objects. Obviously Visual Basic is not the only choice: Microsoft Visual C++, Borland's Delphi and Microsoft Visual J++ are among many programming environments that can be deployed for this task.

All of QuickField's functionality is exposed to a developer as methods and properties; each of them belongs to some object. Before you invoke a method or use a property you have to create the corresponding object. A few of QuickField objects can be directly created by the COM environment. The others are created by another object using some of the parent's methods or properties. The very first QuickField object to use is QuickField.Application. Consider the following code fragment in Visual Basic:

Dim QF as QuickField.Application
set QF = CreateObject("QuickField.Application")

The first line of code declares the QF variable as an object of the QuickField.Application type. To let Basic know about QuickField objects you should go to the Reference dialog and mark the QuickField Object Library as available in the list of registered libraries. The library itself is known to Basic and other Windows application because it was registered in the system registry during the QuickField installaton setup  process.

You can omit the first line of code and use the QF variable without explicit declaration. In this case the Basic will know the exact type of object created only at run-time. This approach is known as a late binding and in many cases appears less time effective.

The second line calls the standard function CreateObject to create the QuickField.Application. The parameter string tells the system what object you want to create. Be sure you have type it exactly as shown. If QuickField is not already running, the system starts it for you in background (without any visible window). Otherwise the running application will be used as a server regardless of whether  is it visible or not.

Visual Basic allows you to join the object declaration and creation in one line:

Dim QF as New QuickField.Application

QuickField objects cannot be created by the GetObject function.

Once obtaining the QuickField.Application object you can manipulate its methods and properties to get some useful result. When you finish you have to free the server. If your application is the only client of the QuickField at the moment, you have to explicitly stop the server:

QF.Problems.Close
QF.Quit

The first line closes all the problems that might be open in QuickField and the second line stops the server exactly as the menu File->Exit command does.

However, there can be a situation when your Basic program uses QuickField non-exclusively. Another client of QuickField might use is at the same time, even yourself as an interactive user. If so, it is not a very good idea for a program to stop the server, as it is its only client. It could be reasonable to close and free up only those object that you have created. When you have closed the objects you opened, as your final step, write the following:

Set QF = Nothing