Closes a window, scanner, SMS or peripheral device connection, or a file that you opened with the FileDirect object.
To close |
Use |
---|---|
A window |
|
A BarcodeScanner or BiometricScanner object |
|
A communications channel for a Camera object |
|
A communications channel for a SerialGPS object |
|
A Short Message Service (SMS) session |
|
A FileDirect object |
|
A trace file |
Closes a window and releases the storage occupied by the window and all the controls in the window.
Window objects
Close ( windowname )
Argument |
Description |
---|---|
windowname |
The name of the window you want to close |
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.
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.
Preventing 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.
These statements close the window w_employee and then open the window w_departments:
Close(w_employee)
Open(w_departments)
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
Clears all buffers, detaches from scanner firmware, and unloads all DLLs.
BarcodeScanner and BiometricScanner objects
Integer scanner.Close ( )
Argument |
Description |
---|---|
scanner |
The scanner object that you want to close |
Integer. Returns 1 for success or -1 if an error occurs.
This is an optional method. It is always called by the Destructor event of BarcodeScanner and BiometricScanner objects.
The following closes scanner DLLs and disconnects from the scanner device firmware:
li_rtn = l_scanner.Close()
Closes a communications channel for a camera if one is open and deactivates any data handlers.
Camera objects
objectname.Close ( )
Argument |
Description |
---|---|
objectname |
Name of the Camera object |
Integer. Returns 1 for success and a negative number for an error.
Use the Close function to close a communications channel for a Camera object you previously opened using the Open function.
The following script closes a file:
li_ret = myCamera.close ( )
Closes a GPS communications channel if one is open and deactivates any data handlers.
SerialGPS objects
GPSname.Close ( )
Argument |
Description |
---|---|
GPSname |
Name of the SerialGPS object |
Integer. Returns 1 for success and a negative number for an error. The following is a list of possible error codes and their meanings:
-10 Invalid object. Could occur if the GPS object instance is corrupted.
-13 Not previously opened. This function cannot be called until a GPS object or SerialGps object has been successfully opened.
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.
The following script closes a file:
li_ret = myGPS.close ( )
Closes a Short Message Service (SMS) session.
SMSSession objects
SMSsessionname.Close ( )
Argument |
Description |
---|---|
SMSsessionname |
Name of the SMSSession object |
Integer. Returns 1 for success and a negative value if an error occurs.
Use the Close function to close an SMS session you previously opened using the Open function.
The following script closes a file:
li_ret = mySMSSession.close ( )
Closes a file that you open with the FileDirect object.
FileDirect objects
instancename.Close ( )
Argument |
Description |
---|---|
instancename |
Instance name of the FileDirect object |
Integer. Returns 1 for success and a negative number for an error.
Use the Close function to close a file you previously opened using the Open function.
The following script closes a file:
li_ret = nvo_FileDirect.close ( )
Closes an open trace file.
TraceFile objects
instancename.Close ( )
Argument |
Description |
---|---|
instancename |
Instance name of the TraceFile object |
ErrorReturn. Returns one of the following values:
Success!—The function succeeded
FileNotOpenError!—A trace file has not been opened
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.
This example closes a trace file:
ift_file.Close()
DESTROY ift_file