BB___OPEN

=OPEN= toc =Window Handling=

Description
> Opens a window for use in a program. Three pieces of information (parameters) are needed to open the window - device, purpose, and handle. >> Device - the window caption (title) >> Purpose - window type >> Handle - the window's unique identifier

> See Window Types and Handles. > Any window which is OPENed must be CLOSEd before ending a program. See CLOSE and TRAPCLOSE.

Syntax

 * 1) open //device// for //purpose// as //#handle//

Example
code format="lb" ' This statement will open a window of "Type Window" with a caption ' of "My First Window" and a handle of #1. The handle is used so ' other parts of the program can interact with this specific window. open "My First Window" for window as #1 ' Notice that the caption is enclosed in quotes (").   ' To make sure program ends properly, use 'trapclose':    #1 "trapclose [quit]"    wait    [quit]    close #1    end

code

Useful Functions
code format="lb" Place a useful function using this command here code

=File Handling=

Description
> Similar to opening a window, opening a file requires three parameters - device, purpose and handle. >> Device - a valid disk filename >> Purpose - type of file access >> Handle - the file's unique identifier

> For purpose, see File Access Types. (Files can be opened for INPUT, OUTPUT, APPEND, RANDOM or BINARY access.) > A file which is OPENed must be CLOSEd before ending a program. See CLOSE.

Syntax

 * 1) open //device// for //purpose// as //#handle//

Example
code format="lb" ' A file can be opened using a literal text expression for the device parameter: open "c:\readme.txt" for input as #f ' Notice that the literal reference must be enclosed in quotes (").

' or, the device parameter can be a string variable: open fileName$ for input as #f code

Useful Functions
code format="lb" Place a useful function using this command here code

=Serial Device Handling=

Description
> Opens a serial communications port for reading and writing. The required parameters are; baud, parity, data, and stop. Additional optional parameters can be included after the required parameters.

> See also the Com buffer size variable, Com Error Handler and Com Port Number > As with the other devices, the port must be CLOSEd when done and before ending the program.

Syntax

 * 1) open //"COMn:baud,parity,data,stop,flags"// for random as //#handle//

Hints

 * Default settings:** DTR disabled, XON/XOFF disabled, binary transfer mode


 * Available baud rates:** 75 110 150 300 600 1200 2400 1800 2400 4800 9600 19200 38400 57600 115200


 * ~ Parity Flags ||  ||~ Data Size ||   ||~ Stop Size ||   ||||||~ Additional Flags ||
 * = **Flag** ||  ||= **Meaning** ||   ||= **bits long** ||   ||= **bits long** ||   ||= **Flag** ||   ||= **Meaning** ||
 * = N ||  || No parity ||   ||= 5 ||   ||= 1 ||   ||= CSn ||   || CTS timeout, default 1000ms, 0ms = off ||
 * = E ||  || Even parity ||   ||= 6 ||   ||= 2 ||   ||= DSn ||   || DSR timeout, default 1000ms, 0ms = off ||
 * = O ||  || Odd parity ||   ||= 7 ||   ||   ||   ||= PE ||   || Enable parity checks ||
 * = S ||  || Space parity ||   ||= 8 ||   ||   ||   ||= RS ||   || Disable RTS ||
 * = M ||  || Mark parity ||   ||   ||   ||   ||   ||   ||   ||   ||

Example
code format="lb" ' To open com port 2 at 9600 baud, 8 data bits, 1 stop bit, and no parity, use this line of code: open "com2:9600,n,8,1" for random as #commHandle ' Notice that the device reference is enclosed in quotes ("). code

Useful Functions
code format="lb" Place a useful function using this command here code