Close

Closes a window, scanner, SMS or peripheral device connection, or a file that you opened with the FileDirect object.

To close

Use

A window

Syntax 1 For windows

A BarcodeScanner or BiometricScanner object

Syntax 2 For BarcodeScanner and BiometricScanner objects

A communications channel for a Camera object

Syntax 3 For Camera objects

A communications channel for a SerialGPS object

Syntax 4 For GPS and SerialGPS objects

A Short Message Service (SMS) session

Syntax 5 For SMSSession objects

A FileDirect object

Syntax 6 For FileDirect objects

A trace file

Syntax 7 For trace files


Syntax 1 For windows

Description

Closes a window and releases the storage occupied by the window and all the controls in the window.

Applies to

Window objects

Syntax

Close ( windowname )

Argument

Description

windowname

The name of the window you want to close

Returns

Integer. Returns 1 if it succeeds and -1 if an error occurs. If windowname is null, Close returns null. The return value is usually not used.

Usage

Use Syntax 1 to close a window and release the storage occupied by the window and all the controls in the window.

When you call Close, PocketBuilder removes the window from view, closes it, executes the scripts for the CloseQuery and Close events (if any), and then executes the rest of the statements in the script that called the Close function.

After a window is closed, its properties, instance variables, and controls can no longer be referenced in scripts. If a statement in the script references the closed window or its properties or instance variables, an execution error will result.

NotePreventing a window from closing You can prevent a window from being closed with a return code of 1 in the script for the CloseQuery event. Use the RETURN statement.

Examples

Example 1

These statements close the window w_employee and then open the window w_departments:

Close(w_employee)

Open(w_departments)

Example 2

After you call Close, the following statements in the script for the CloseQuery event prompt the user for confirmation and prevent the window from closing:

IF MessageBox('ExitApplication', &

'Exit?', Question!, YesNo!) = 2 THEN

    // If no, stop window from closing

    RETURN 1

END IF

See also


Syntax 2 For BarcodeScanner and BiometricScanner objects

Description

Clears all buffers, detaches from scanner firmware, and unloads all DLLs.

Applies to

BarcodeScanner and BiometricScanner objects

Syntax

Integer scanner.Close ( )

Argument

Description

scanner

The scanner object that you want to close

Returns

Integer. Returns 1 for success or -1 if an error occurs.

Usage

This is an optional method. It is always called by the Destructor event of BarcodeScanner and BiometricScanner objects.

Examples

Example 3

The following closes scanner DLLs and disconnects from the scanner device firmware:

li_rtn = l_scanner.Close()

See also


Syntax 3 For Camera objects

Description

Closes a communications channel for a camera if one is open and deactivates any data handlers.

Applies to

Camera objects

Syntax

objectname.Close ( )

Argument

Description

objectname

Name of the Camera object

Returns

Integer. Returns 1 for success and a negative number for an error.

Usage

Use the Close function to close a communications channel for a Camera object you previously opened using the Open function.

Examples

Example 4

The following script closes a file:

li_ret = myCamera.close ( )

See also

Open


Syntax 4 For GPS and SerialGPS objects

Description

Closes a GPS communications channel if one is open and deactivates any data handlers.

Applies to

SerialGPS objects

Syntax

GPSname.Close ( )

Argument

Description

GPSname

Name of the SerialGPS object

Returns

Integer. Returns 1 for success and a negative number for an error. The following is a list of possible error codes and their meanings:

Usage

Use the Close function to close a communications channel for a SerialGPS object you previously opened using the Open function. The Close function reinitializes all internal variables to their default values, but the ConfigParams property for SerialGPS objects is not reinitialized. This allows the user to reopen the SerialGPS object without having to respecify all of the configuration parameters.

Examples

Example 5

The following script closes a file:

li_ret = myGPS.close ( )

See also

Open


Syntax 5 For SMSSession objects

Description

Closes a Short Message Service (SMS) session.

Applies to

SMSSession objects

Syntax

SMSsessionname.Close ( )

Argument

Description

SMSsessionname

Name of the SMSSession object

Returns

Integer. Returns 1 for success and a negative value if an error occurs.

Usage

Use the Close function to close an SMS session you previously opened using the Open function.

Examples

Example 6

The following script closes a file:

li_ret = mySMSSession.close ( )

See also

Open


Syntax 6 For FileDirect objects

Description

Closes a file that you open with the FileDirect object.

Applies to

FileDirect objects

Syntax

instancename.Close ( )

Argument

Description

instancename

Instance name of the FileDirect object

Returns

Integer. Returns 1 for success and a negative number for an error.

Usage

Use the Close function to close a file you previously opened using the Open function.

Examples

Example 7

The following script closes a file:

li_ret = nvo_FileDirect.close ( )

See also

Open


Syntax 7 For trace files

Description

Closes an open trace file.

Applies to

TraceFile objects

Syntax

instancename.Close ( )

Argument

Description

instancename

Instance name of the TraceFile object

Returns

ErrorReturn. Returns one of the following values:

Usage

You use the Close function to close a trace file you previously opened with the Open function. You use the Close and Open functions as well as the properties and functions of the TraceFile object to access the contents of a trace file directly. You use these functions if you want to perform your own analysis of the tracing data instead of building a model with the Profiling or TraceTree object and the BuildModel function.

Examples

Example 8

This example closes a trace file:

ift_file.Close()

DESTROY ift_file

See also