Mnemonics "C"

From CometWiki

(Difference between revisions)
Jump to: navigation, search
((CH))
((CH))
Line 67: Line 67:
'''Mnemonic''': (CH) Hex equivalent:  
'''Mnemonic''': (CH) Hex equivalent:  
 +
'''Discussion''': Cursor home. The (CH) control code moves the cursor to the "home" position on the screen. Home position is the upper left foreground location of the screen. Since the cursor will land only in a foreground area, "home" may be something other than the upper left corner.  
'''Discussion''': Cursor home. The (CH) control code moves the cursor to the "home" position on the screen. Home position is the upper left foreground location of the screen. Since the cursor will land only in a foreground area, "home" may be something other than the upper left corner.  

Revision as of 18:23, 4 September 2009

Contents

(CA Sessions)

Mnemonic: (CA Sessions=maximum-number-of-sessions)

Discussion: This mnemonic sets a limit on the number of CometAnywhere sessions. The maximum-number-of-sessions is a decimal value. To get information on the current setting, set the argument to 0 and follow the mnemonic with an INPUT (see example 2).

Example 1: Print (CA Sessions=3)

This example sets the maximum number of CometAnywhere sessions to 3.

Example 2: Print (CA Sessions=0) Input A$

This example sets the argument to 0.

As a result, the current setting is returned to the string variable contained in the next INPUT statement following the mnemonic. The return value is a one-byte hex string. For example, if the current maximum-number-of-sessions is 3, the hex value "@03@" is assigned to A$.

(CapsOff)

Mnemonic: (CapsOff) Discussion: This mnemonic turns the Caps Lock keyboard function off. See (CapsOn). 

Example: Print (CapsOff) 

(CapsOn)

 
Mnemonic: (CapsOn) Discussion: This mnemonic turns the Caps Lock keyboard function on. See (CapsOff). 

Example: Print (CapsOn) 

(CC)

Email Mnemonic: (CC=string-argument)

Discussion: The (CC) mnemonic may be used to specify the "carbon copy" recipients of your email message. Example: OPEN (1) "LEH" PRINT (1) (CC="barbara@@signature.net")

(CF)

Mnemonic: (CF) Hex equivalent: "@06@"

Discussion: Clear foreground. The (CF) control code clears all foreground screen positions to foreground blanks and positions the cursor at the first foreground position on the screen (the upper left corner). This control does not affect background or invisible (suppressed background) screen positions.

This control code is typically used to clear input data from a formatted screen after it is entered in order to prepare for the next set of input data.

Example: a. 100 FORMAT (CF) 
  .
  PRINT (0,100)
b. PRINT (0) (CF) 

This example shows how to clear all foreground screen positions.

Read about other Email Mnemonics

(CFLD)

Mnemonic: (CFLD) Hex equivalent: "@0407@"

Discussion: Clear field. The (CFLD) control code clears all foreground characters in a field in which the cursor is located and replaces them with foreground blanks. It then positions the cursor in the first position of the field (left-most position for alphanumeric fields and right-most position for right-justified numeric fields). The control code does not affect background or invisible (suppressed background) fields.

This control code may also include a positioning statement to start the clearing operation at a specific point on the screen.

Example: 
        a. 100 FORMAT (CFLD),@(10,0) 
  .
                 PRINT (0,100)
        b. PRINT (0) (CFLD),@(10,0) 

These examples demonstrates the "clear field" control code. The positioning statement puts the control into action at column 10, row 0. If this location is a foreground field, it will be cleared to foreground blanks (if not, the control code will do nothing).

(CH)

Mnemonic: (CH) Hex equivalent:

Discussion: Cursor home. The (CH) control code moves the cursor to the "home" position on the screen. Home position is the upper left foreground location of the screen. Since the cursor will land only in a foreground area, "home" may be something other than the upper left corner.

For example, if the upper left corner of the screen contains background or invisible (suppressed background) characters, the cursor will search to the right and to the next line(s) if necessary for the first available foreground position.

Once a foreground field is located, the cursor will be positioned at the first location in that field (left-most position for alphanumeric fields and right-most position for right-justified numeric fields).

 
Example: 
    a. 100 FORMAT (CH) 
         .
        PRINT (0,100)
    b. PRINT (0) (CH) 

This example shows how to move the cursor to the home position.

(Change Color)

Mnemonic: (Change Color=ARG1$) Hex equivalent: "@0E0E0Bxx00@" where: xx = the foreground color 

Discussion: This mnemonic changes the foreground color attribute on the Comet console, and is effective only for the current write operation. ARG1$ is the foreground color; it may be a string constant or a string variable containing the hex representation of the screen color. 




See Screen Colors for a list of color codes. 

Also see (Change Colors) for a way to change all of the screen colors. 

Example: a. 100 FORMAT (Change Color="@07@") 

  .
  PRINT (0,100)
b. PRINT (0) (Change Color="@07@") 

(Change Colors)

Mnemonic: (Change Colors=ARG1$,ARG2$,ARG3$,ARG4$,ARG5$)

Hex equivalent: "@0E0E0Evvwwxxyyzz@" where: vv = the foreground color ww = the background color xx = the invisible color (for TM's, TP's, and RJ's) yy = the border color zz = the entry field color


Discussion: The mnemonic changes all of the screen colors on the Comet console, or within the current Comet window. ARG1$ is the foreground color ARG2$ is the background color ARG3$ is the invisible color (for TM's, TP's, and RJ's) ARG4$ is the border color ARG5$ is the entry field color


All of these arguments are in hex and may be string constants or a string variable containing the hex representation of the screen color.



See Screen Colors for a list of color codes.

Also see (Change Color) for a way to change the foreground color only.

Example: a. 100 FORMAT (Change colors="@0F@","@A0@","@00@","@C0@","@0F@")

 .
 PRINT (0,100)

b. Print (0) (Change colors="@0F@","@A0@","@00@","@C0@","@0F@")

(CPL132)

 
Mnemonic: (CPL132) Hex equivalent: "@040009@" Discussion: This mnemonic sets the video display mode to 132 characters per line. Also see (Screen), (CPL64), (CPL80), and (DE). 

Example: a. 100 FORMAT (CPL132) 

  .
  PRINT (0,100)
b. PRINT (0) (CPL132) 

(CPL64)

 Mnemonic: (CPL64) Hex equivalent: "@0402@" Discussion: The (CPL64) control code sets the screen display mode to 64 characters per line by 27 lines. The screen is cleared to foreground blanks and the cursor is moved to the "home" position. (Note: In normal mode, the cursor will be moved to the upper left corner of the screen. If typewriter mode is in effect, the cursor will be moved to the lower left corner of the screen.) This control code may be overridden by the system configuration (if the configuration forces the screen display to 80 columns, for example). 

Also see (Screen), (CPL132), (CPL80), and (DE). 

Example: a. 100 FORMAT (CPL64) 

  .
  PRINT (0,100)
b. PRINT (0) (CPL64) 

 

== (CPL80) ==  
Mnemonic: (CPL80) Hex equivalent: "@0403@" Discussion: The (CPL80) control code sets the screen display mode to 80 characters per line by 24 lines. The screen is cleared to foreground blanks and the cursor is moved to the "home" position. (Note: In normal mode, the cursor will be moved to the upper left corner of the screen. If typewriter mode is in effect, the cursor will be moved to the lower left corner of the screen.) Also see (Screen), (CPL132), (CPL64), and (DE). 

Example: a. 100 FORMAT (CPL80) 

  .
  PRINT (0,100)
b. PRINT (0) (CPL80) 



(Check Box Off)

 
Note: This feature is not supported beyond Comet 504. Mnemonic: (Check Box Off) Hex equivalent: "@CAC6B6@" Discussion: This mnemonic draws a graphical check box on the screen. The check box is in the "off" position (i.e., no check mark appears in the box), as shown here: 


The check box symbol occupies 3 spaces on the screen. 

Note: The (Enhanced Characters On) mnemonic must be used before the (Check Box Off) mnemonic us used. 

Also see (Check Box On). 

Example: a. 100 FORMAT (Check Box Off) 

  .
  PRINT (0,100)
b. PRINT (0) (Check Box Off) 

(Check Box On)

 
Note: This feature is not supported beyond Comet 504. Mnemonic: (Check Box On) Hex equivalent: "@CACEB6@" Discussion: This mnemonic draws a graphical check box on the screen. The check box is in the "on" position (i.e., a check mark appears in the box), as shown here: 


The check box symbol occupies 3 spaces on the screen. 

Note: The (Enhanced Characters On) mnemonic must be used before the (Check Box On) mnemonic us used. 

Also see (Check Box Off). 

Example: a. 100 FORMAT (Check Box On) 

  .
  PRINT (0,100)
b. PRINT (0) (Check Box On) 

Retrieved from "http://64.142.11.195/index.php/Mnemonics"

(CFLD)

Mnemonic:   (CFLD)  
Hex equivalent:  "@0407@"  
Discussion:  Clear field. 
The (CFLD) control code clears all foreground characters in a field in which the cursor is located and replaces them with foreground blanks. It then positions the cursor in the first position of the field (left-most position for alphanumeric fields and right-most position for right-justified numeric fields). The control code does not affect background or invisible (suppressed background) fields. 

This control code may also include a positioning statement to start the clearing operation at a specific point on the screen. 
 
Example:  a. 100 FORMAT (CFLD),@(10,0)
   .
   PRINT (0,100)

b. PRINT (0) (CFLD),@(10,0)

This example demonstrates the "clear field" control code. The positioning statement puts the control into action at column 10, row 0. If this location is a foreground field, it will be cleared to foreground blanks (if not, the control code will do nothing).  

(CF)

 
Mnemonic:   (CF)  
Hex equivalent:  "@06@"  
Discussion:  Clear foreground. 
The (CF) control code clears all foreground screen positions to foreground blanks and positions the cursor at the first foreground position on the screen (the upper left corner). This control does not affect background or invisible (suppressed background) screen positions. 

This control code is typically used to clear input data from a formatted screen after it is entered in order to prepare for the next set of input data. 
 
Example:  a. 100 FORMAT (CF)
   .
   PRINT (0,100)

b. PRINT (0) (CF)

This example shows how to clear all foreground screen positions.  


== (CS) ==
 
Mnemonic:   (CS)  
Hex equivalent:  "@05@"  
Discussion:  Clear screen. 
The (CS) control code clears the entire screen to foreground blanks and moves the cursor to the home position. 
 
Example:  a. 100 FORMAT (CS)
   .
   PRINT (0,100)

b. PRINT (0) (CS)

(Close Icon)

 
Note: This feature is not supported beyond Comet 504. 
Mnemonic:   (Close Icon)  
Hex equivalent:  "@CCB8@"  
Discussion:  This mnemonic draws a graphical "close" icon on the screen, as shown here: 
 

The close icon occupies 2 spaces on the screen. 

Note: The (Enhanced Characters On) mnemonic must be used before the (Close Icon) mnemonic us used. 
 
Example:  a. 100 FORMAT (Close Icon)
   .
   PRINT (0,100)

b. PRINT (0) (Close Icon)

Close the mouse

Use the following instruction to close the mouse driver: 


     PRINT (0) (Mouse off)

See also Show/hide the mouse cursor. 

The mouse cursor may be shown or hidden. For mouse-driven applications, you will normally want to show the mouse cursor. For touch-sensitive screen applications, you will normally want to hide the mouse cursor. 


To show the regular cursor, use the following instruction: 

          PRINT (0) (Show Mouse Cursor)


To hide the regular cursor, use the following instruction: 

          PRINT (0) (Hide Mouse Cursor)

Also see Regular cursor display. 

(Copy from Clipboard)

 
Mnemonic:  (Copy from Clipboard)  
Discussion:  This mnemonic, which is used with the system driver (X00), copies the contents from the Windows clipboard into one or more program variables. This mnemonic is issued via a PRINT statement, and the clipboard data is obtained via a subsequent INPUT statement (see example below). 
Also see:

(Copy to Clipboard)


(Query Clipboard)

 
History:  This mnemonic was added in REL 01.05 and requires Build 292 or higher.  
Example 1:  LENGTH 254 & LOCAL RESULT$       ! Define a variable
.
.
.
Open (1) "X00"                   ! Open system driver
Print (1) (CopyFromClipboard)    ! Copy data from clipboard
Input (1) Result$                ! to this variable
Close (1)                        ! Close system driver

 
Example 2:  LENGTH 254 & LOCAL A$,B$,C$      ! Define 3 variables

CLIP: FORMAT A$;B$;C$            ! FORMAT statement for clipboard data

Open (1) "X00"                   ! Open system driver
Print (1) (CopyFromClipboard)    ! Copy data from clipboard
Input (1,CLIP)                   ! to the variables in this FORMAT statement
Close (1)                        ! Close system driver

(Copy to Clipboard)

Mnemonic:  (Copy to Clipboard)  
Discussion:  This mnemonic, which is used with the system driver (X00), copies program data to the Windows clipboard. This mnemonic is issued via a PRINT statement (see examples below). 
This mnemonic returns a result string, so it is necessary to issue an INPUT statement following the PRINT statement. However, since this mnemonic should never fail, the result string will not contain any meaningful data. 

Also see:
(Copy from Clipboard)
(Query Clipboard) 
 
History:  This mnemonic was added in REL 01.05 and requires Build 292 or higher.  
Example 1:  LENGTH 254 & LOCAL RESULT$
.
.
.
Open (1) "X00"
Print (1) (Copy to Clipboard);"This is some data for the clipboard."
Input (1) Result$
Close (1)

 
Example 2:  LENGTH 254 & LOCAL RESULT$,DATA$
.
.
.
DATA$ = "This is some data for the clipboard."
Open (1) "X00"
Print (1) (Copy to Clipboard);DATA$
Input (1) Result$
Close (1)

 
Example 3:  LENGTH 254 & LOCAL RESULT$
.
.
.
Open (1) "X00"
Print (1) (Copy to Clipboard);""     ! Clear the clipboard
Input (1) Result$
Close (1)

(CopyFile)

Mnemonic: (CopyFile=source-file,destination-file,flags)

Discussion: This mnemonic copies the source-file to the destination-file, using the specified flags.

This mnemonic may be used by foreground programs only.

Note: The (CopyFile) mnemonic is intended to replace (Verify File).

The source-file, which is specified as a full Windows path, UNC path, or directory alias, may be located on a local Comet system/network or a CometAnywhere client system (default is local system).

The destination-file, which is specified as a full Windows path, UNC path, or directory alias, may be located on a local Comet system/network or CometAnywhere client system (default is local system).

When issued on lun (0), this mnemonic copies a file:

  • from a local Comet system/network to itself
  • from a local Comet system/network to a CometAnywhere client system
  • from a CometAnywhere client system to a local Comet system/network
  • from the CometAnywhere client system to itself

The mnemonic provides many powerful features, such as an option to compare the source file's modify date with the destination file's modify date (in the case where the destination file already exists) in order to determine whether the source file needs to be copied, an option to display a progress bar during CometAnywhere transfers, and options to create a directory, overwrite an existing file, and create a CAFILE alias if required.

Flags is a numeric value representing the sum of the numeric values listed in the following chart:

Flag Description

  1. The source file is located on the CometAnywhere client system
  2. CometAnywhere is required if remote files are specified

If a flag is set indicating that the source file is located on a CometAnywhere client system (flag=1) and/or that the destination file is located on a CometAnywhere client system (flag=512), but the user is running on a local Comet system (i.e., not a CometAnywhere client system):

If this flag is set, an error is reported (see function error 2). If this flag is not set, Comet substitutes the local drive/path name for a remote path/drive name.

64 Synchronize source and destination files If the source file is newer than the destination file, or the destination file does not exist, the destination file is updated (assuming that the other flags call for the copying to occur).

If this flag is omitted, the destination file is updated (assuming that the other flags call for the copying to occur).

Note: Different file systems may return file update times in different formats. For example, the NT file system (NTFS) returns file update times in Coordinated Universal Time (abbreviated as UTC; formely known as Greenwich Mean Time), while FAT returns file update times in local time. Therefore, when using this flag, make sure that the source and destination files use the same file system and return the file update times in the same format.

128 Create CAFILES alias if required If an alias is specified in the destination file name, and the alias doesn't already exist, this flag creates the alias.

256 Don't copy the file; just indicate if an update is needed See the function error codes (below), particularly values 20 and 21.

512 The destination file is located on the CometAnywhere client system 1024 Show a progress bar for transfers between a local Comet system/network and a CometAnywhere client system 2048 Overwrite existing file If the destination file already exists, overwrite it with the contents of the source file.

4096 Create directory If a directory is specified for the destination file, and that directory does not already exist, create it.


After this mnemonic is issued, your program can issue an INPUT on LUN (0) to retrieve success/error information. For example:

 LENGTH 2 & LOCAL AX$,DX$
 ResultFmt: FORMAT AX$;DX$
 .
 .
 Print (CopyFile=Source$,Dest$,Flags)
 Input (0,ResultFmt)

The first field, AX$, contains the function error code, and the second field, DX$, contains the suberror code (aka the Windows file error code). Both of these fields are in Intel 2's complement format, and should be processed as follows:

 AX$ = SUB(AX$,2,1) + SUB(AX$,1,1)   ! Flip the bytes around
 DX$ = SUB(DX$,2,1) + SUB(DX$,1,1)   ! Flip the bytes around
 FuncError = HexDec(AX$)             ! Function error code (decimal)
 FileError = HexDec(DX$)             ! File error code (decimal)
 ! For unexpected values, convert to 2's complement signed integer
 If (FuncError > 32767) FuncError = FuncError-65536
 If (FileError > 32767) FileError = FileError-65536

Here is a link to Jons error code summary table Comet_Error_Codes#CopyFileErrors:

Here is a list of the function error codes in decimal form: Error (FuncError) Description 0 Function not supported 1 Success -- update performed 2 CometAnywhere required 3 Source file error (see suberrors) 4 Aborted by user 5 Function in progress 20 Success -- update not required 21 Success -- update required 22 Destination file error (see suberrors)


Here is a list of the suberror codes (common Windows file errors) in decimal form:

Suberror (FileError) Description 0 Success 2 File not found 3 Path not found 5 Access denied 12 Invalid access 15 Invalid drive 16 An error has occurred in the current directory 18 No more files 32 Sharing violation 33 Lock violation 39 File located on Remote Computer 80 File exists 123 The Filename, Directory Name, or Volume Label Syntax Is Incorrect 161 Bad pathname 1326 User not logged in to Remote Computer


History: This mnemonic was added in Comet Build 299 and REL Version 01.07. Example 1: Source$ = "C:\SAMPLEFILES\TEST.TXT" Dest$ = "A:\TEST.TXT" Flags = 2048 Print (CopyFile=Source$,Dest$,Flags)


This example copies the source file named C:\SAMPLEFILES\TEST.TXT to the destination file named A:\TEST.TXT. By default, both files are located on the local Comet system/network. The flag value of 2048 tells Comet to overwrite the destination file if it exists. If the copying is successful, the function error code will be equal to 1 (Success -- update performed), and the suberror code will be equal to 0 (Success).


Example 2: Source$ = "C:\FILE1.TXT" Dest$ = "C:\FILE2.TXT" Flags = 512 + 2048 Print (CopyFile=Source$,Dest$,Flags)


This example copies a source file named C:\FILE1.TXT to a destination file named C:\FILE2.TXT The sum of the two flags tells Comet that the destination file is on the CometAnywhere client system (512), and to overwrite the destination file if the destination file already exists (2048). By default, the source file is on the local Comet system.

Suppose the flag value was changed to the following:

Flags = 1 + 2048

This would tell Comet that the source file is on the CometAnywhere client system (1), while the destination file (by default) is on the local Comet system. The destination file would be overwritten (2048). Suppose the flag value was changed to the following:

Flags = 1 + 512 + 2048

In this case, the source and destination files are located on the CometAnywhere client system (1 and 512), and the destination file will be overwritten (2048).

Example 3: Suppose you want to copy a file from a local Comet system to a CometAnywhere client system, and you want to synchronize the files (i.e., copy only if the source file is newer than the destination file). Here are the flags that are used in the following example:

  2 = CometAnywhere is required (otherwise an error occurs)
 64 = Synchronize the files
512 = Destination file is on CometAnywhere client system

1024 = Show progress bar 2048 = Overwrite existing file 4096 = Create directory


Source$ = "C:\FILE1" Dest$ = "C:\DATA\FILE2" Flags = 2 + 64 + 512 + 1024 + 2048 + 4096 Print (CopyFile=Source$,Dest$,Flags)


Example 4: Suppose you need to copy a large file between a local Comet system and a CometAnywhere client system, but before copying you want to check and see if (a) the update is needed, and (b) if the user wants to perform the update now. This is done in two steps. First, use the flag that checks to see if the update is required without copying the file (flag=256). If the update is required (as indicated by FuncError=21), then proceed with the copying (change the flags to copy the file).


Source$ = "C:\BIGFILE"  ! on local Comet system Dest$ = "C:\BIGFILE"  ! on CometAnywhere client system

Flags = 256 + 512  ! 256 = don't copy file; just check to

                       !       see if updated is needed
                       ! 512 = destination is on
                       !       CometAnywhere system

Print (CopyFile=Source$,Dest$,Flags) Input (0,ResultFmt)

AX$ = SUB(AX$,2,1) + SUB(AX$,1,1)  ! Flip the bytes around DX$ = SUB(DX$,2,1) + SUB(DX$,1,1)  ! Flip the bytes around FuncError = HexDec(AX$)  ! Function error code (decimal) FileError = HexDec(DX$)  ! File error code (decimal)

! For unexpected values, convert to 2's complement signed integer If (FuncError > 32767) FuncError = FuncError-65536 If (FileError > 32767) FileError = FileError-65536

If FuncError = 21

 Print "The file needs to be updated."
 Print "Do you want to update it now?"
 Input A$
 If A$ = "Y"
   Flags = 512 + 2048
   Print (CopyFile=Source$,Dest$,Flags)
   Input (0,ResultFmt)
   .
   .
   .
 EndIf

EndIf


Notes: Depending on your situation you might try using the CUtlCpy utility which is released as part of the UTL directory. You can ENTER it from your app to easily accomplish a file copy or move. To use a directory alias as the pathname for either of the filenames you can do it like this: FileName$ = "$(AliasNameHere)\" + thefilename$

(CPL132)

 
Mnemonic:   (CPL132)  
Hex equivalent:  "@040009@"  
Discussion:  This mnemonic sets the video display mode to 132 characters per line. 
Also see (Screen), (CPL64), (CPL80), and (DE). 
 
Example:  a. 100 FORMAT (CPL132)
   .
   PRINT (0,100)

b. PRINT (0) (CPL132)

(CPL64)

 
Mnemonic:   (CPL64)  
Hex equivalent:  "@0402@"  
Discussion:  The (CPL64) control code sets the screen display mode to 64 characters per line by 27 lines. The screen is cleared to foreground blanks and the cursor is moved to the "home" position. (Note: In normal mode, the cursor will be moved to the upper left corner of the screen. If typewriter mode is in effect, the cursor will be moved to the lower left corner of the screen.) 
This control code may be overridden by the system configuration (if the configuration forces the screen display to 80 columns, for example). 

Also see (Screen), (CPL132), (CPL80), and (DE). 
 
Example:  a. 100 FORMAT (CPL64)
   .
   PRINT (0,100)

b. PRINT (0) (CPL64)

(CPL80)

 
Mnemonic:   (CPL80)  
Hex equivalent:  "@0403@"  
Discussion:  The (CPL80) control code sets the screen display mode to 80 characters per line by 24 lines. The screen is cleared to foreground blanks and the cursor is moved to the "home" position. (Note: In normal mode, the cursor will be moved to the upper left corner of the screen. If typewriter mode is in effect, the cursor will be moved to the lower left corner of the screen.) 
Also see (Screen), (CPL132), (CPL64), and (DE). 
 
Example:  a. 100 FORMAT (CPL80)
   .
   PRINT (0,100)

b. PRINT (0) (CPL80)

(CR)

 
Mnemonic:    (CR)  
Discussion:  Cursor return/carriage return. 
This control code can be used on a video device or a printer. 

Video device
In normal mode, the (CR) control code moves the cursor to the first foreground position on the following line. If the cursor is on the bottom line when this control code is issued, the cursor will be moved to the top line of the screen. In either case, the cursor will land only in a foreground field. 

In typewriter mode, this control code scrolls the screen up one line (forcing the top line off the screen) and will move the cursor to the beginning (left side) of the bottom line on the screen. 

Printer
The (CR) control code performs a carriage return function for the printer. If this control is issued in the middle of a print line, it advances the printer to the beginning of the next line (unlike a line feed control, which would skip the next line and move to the beginning of the following line). 
 
Example (video):  a. 100 FORMAT (CR)
   .
   PRINT (0,100)

b. PRINT (0) (CR)

 
Example (printer):  a. 100 FORMAT "CUSTOMER LISTING";(CR);"PRINTED ON:";DAY$
   .
   OPEN (1) "LP1"
   .
   PRINT (1,100)


b. OPEN (1) "LP1"
   .
   PRINT (1) "CUSTOMER LISTING";(CR);"PRINTED ON:";DAY$

This example prints a heading, performs a carriage return, and then prints a subheading on the next line.  

(Create Window)

 
Mnemonic:   (Create Window=a,b,c,d) 
where:
a = upper left column (decimal)
b = upper left row (decimal)
c = lower right column (decimal)
d = lower right row (decimal)

 
Hex equivalent:  "@0E0D00wwxxyyzz@" 
where:
ww = upper left row (hex)
xx = upper left column (hex)
yy = lower right row (hex)
zz = lower right column (hex)

 
Discussion:  This mnemonic creates a Comet window using the specified screen coordinates. Note: These coordinates are relative to the full screen (e.g., column 0, row 0 always represents the upper left corner of the display). 
When a window is created, the amount of available window memory decreases by the size of the window. To determine how much window memory remains, perform a numeric input immediately following the creation of a window. See the window memory page for more information. If you do not need to know how much window memory remains, perform a null INPUT immediately after printing the (Create Window) mnemonic. 

Also see the discussion on Comet windows. 
 
Example:  a. 100 FORMAT (Create Window=2,3,70,20)
   .
   PRINT (0,100)
   INPUT (0) ""

b. PRINT (0) (Create Window=2,3,70,20)
   INPUT (0) ""

This example show how to create a Comet window from column 2, row 3 (the upper left corner) to column 70, row 20 (the lower right corner). The INPUT (0) "" statement allows the program to bypass the value that is returned from the (Create Window) mnemonic (the amount of remaining window memory).  

(CreateWindowEx)

 
Mnemonic:   (CreateWindowEx=column,row,width,height,style,flags,caption$)  
Discussion:  This mnemonic creates and selects an extended window, using the following parameters: 
Parameter Description 
column The column location of the upper, left-hand corner of the window. This numeric value is expressed in QCRT characters or screen pixels, depending on the value of the flags (see below). 
row The row location of the upper, left-hand corner of the window. This numeric value is expressed in QCRT characters or screen pixels, depending on the value of the flags (see below). 
width The width of the window. This numeric value is expressed in QCRT characters. 
height The height of the window. This numeric value is expressed in QCRT characters. 
style The style of Window. This numeric value is the sum of the following options: 
Value Meaning 
1 A popup window. The window can be moved outside of Comet window. This value should not be used with 2 (which specifies a child window).  
2 A child window. The window remains within the view window. This value should not be used with 1 (which specifies a popup window). 
4 The window includes a caption bar. 
8 The window includes a border. 
16 The caption bar includes an "X" which closes the window. 
Note: Clicking on the "X" causes an (EasyScan) event to be reported to the Internet Basic program. The EasyScan value is 15.
 
32 The window includes a thick frame that lets the user resize the window. 
64 The window is visible. 

 
flags The flags for the window. This numeric value is the sum of the following options: 
Value Meaning 
0 A modeless window (also known as a user-selectable window). 
Note: If multiple Comet windows are displayed, the user can select which window is the active one by clicking the caption bar. The Internet Basic program can determine the handle of the the window from which data was transmitted via the STS function.
 
1 A modal window. All other Comet windows are disabled until this window closes. 
2 A child window with no frame (border). This flag can be used to simulate a legacy Comet window (see CreateWindow). 
4 The window includes a message line (also known as a control line). Any text written with the (WC) mnemonic will be displayed on the message line within this window. 


The following flags pertain to non-child windows only: 

Value Meaning 
8 The column and row positions are expressed in screen pixels, and are relative to the screen (i.e., 0,0 = the upper, left-hand pixel of the screen). 
16 The column and row positions are expressed in screen pixels, and are relative to the client window (i.e., 0,0 = the upper, left-hand pixel of the client window). 
32 The column and row positions are expressed in screen pixels, and are relative to the frame window (i.e., 0,0 = the upper, left-hand pixel of the frame window). 

 
caption$ If the caption bar style is in effect, this string value is displayed on the caption bar. 


Each extended window is identified by a 4-byte string known as a window handle. The handle value is assigned by the system and returned to the Internet Basic program via an INPUT statement following the (CreateWindowEx) mnemonic, as follows: 

Length 4 & Local Handle1$
.
.
.
Print (CreateWindowEx=0,0,35,15,68,1,"This is the caption")
Input Handle1$

It follows that the Internet Basic program can create multiple extended windows. The program can select which window to use via the (SelectWindowEx) mnemonic. 
An extended window is deleted via the (DeleteWindowEx) mnemonic. 
 
Note:  If you write a program that displays more than one extended window at a time, your program may need some way to distinguish which window was active at the time that data was input. The STS function returns the handle of the window that generated the input. This 4-byte value starts in position 11, as shown here: 
Length 4 & Local Handle$
.
Handle$ = SUB(STS(0),11,4)

 
Symbolic constants:  Symbolic constants can be very useful when dealing with the multiple style and flag values. For example, here is a list of recommended symbolic constants for extended windows: 
! Window style
SET COS.WS.POPUP        = 1   ! Can be moved outside of Comet window. Should
                              ! not be used with COS.WS.CHILD.
SET COS.WS.CHILD        = 2   ! Remains within view window. Should not be used
                              ! with COS.WS.POPUP.
SET COS.WS.CAPTION      = 4   ! Includes a caption bar
SET COS.WS.BORDER       = 8   ! Window includes a border
SET COS.WS.SYSMENU      = 16  ! Caption bar 'X' closes window
SET COS.WS.THICKFRAME   = 32  ! Thick frame for sizing
SET COS.WS.VISIBLE      = 64  ! Window is visible
SET COS.WS.POPUPWINDOW  = 25  ! (COS.WS.POPUP+COS.WS.BORDER+COS.WS.SYSMENU)

! Window flags
SET COS.WF.MODELESS     = 0   ! - User selectable window - Use EasyScan
                              ! to determine when a window is activated.
SET COS.WF.MODAL        = 1   ! - All other windows are disabled until
                              ! this window closes
SET COS.WF.NOFRAME      = 2   ! Create CHILD window with no frame (border).
                              ! Used to simulate a Comet window
SET COS.WF.MSGLINE      = 4   ! Has a message line

! The following flags pertain to non-child windows only
SET COS.WF.SCNPIXELPOS  = 8   ! Position is in pixels, screen relative
SET COS.WF.CLIPIXELPOS  = 16  ! Position is in pixels, client window relative
SET COS.WF.FRMPIXELPOS  = 32  ! Position is in pixels, frame window relative

 


With these symbolic constants in place, you can specify the style and flag values by writing a symbolic "formula," as follows: 

Length 3.0 & Local Style, Flags
Length 5 & Local Handle1$
.
.
.
Style = COS.WS.POPUPWINDOW + COS.WS.CAPTION
Flags = COS.WF.MODAL + COS.WF.MSGLINE + COS.WF.CLIPIXELPOS
Print (CreateWindowEx=0,0,35,15,Style,Flags,"This is the caption")
Input Handle1$

 
History:  This feature is supported in Comet2002 Build 306 and higher.  
Examples:  See the WinDemo.ibs program (available at www.signature.net/download/demos) for examples of extended windows. This demo program includes many combinations of the style and flags parameters, and also demonstrates some very useful applications for extended windows.  

(CrMode)

 
Mnemonic:   (CrMode=mode)  
Discussion:  This mnemonic controls the action of the Enter key. The following values may be used: 
0 = default (from SYSGEN)
1 = Enter key works like Tab
2 = Enter key behaves like a CR (goes to beginning of next
    line unless a TM or TP is encountered)

 
History:  This mnemonic was added in REL 00.06.  
Example:  a. 100 FORMAT (CrMode=1)
   .
   PRINT (0,100)

b. PRINT (0) (CrMode=1)

This example shows how to make the Enter key work like the Tab key.  

(CS)


Mnemonic:   (CS)  
Hex equivalent:  "@05@"  
Discussion:  Clear screen. 
The (CS) control code clears the entire screen to foreground blanks and moves the cursor to the home position. 
 
Example:  a. 100 FORMAT (CS)
   .
   PRINT (0,100)

b. PRINT (0) (CS)

(CH)

 
Mnemonic:   (CH)  
Hex equivalent:   
Discussion:  Cursor home. 
The (CH) control code moves the cursor to the "home" position on the screen. Home position is the upper left foreground location of the screen. Since the cursor will land only in a foreground area, "home" may be something other than the upper left corner. 

For example, if the upper left corner of the screen contains background or invisible (suppressed background) characters, the cursor will search to the right and to the next line(s) if necessary for the first available foreground position. 

Once a foreground field is located, the cursor will be positioned at the first location in that field (left-most position for alphanumeric fields and right-most position for right-justified numeric fields). 
 
Example:  a. 100 FORMAT (CH)
   .
   PRINT (0,100)

b. PRINT (0) (CH)

This example shows how to move the cursor to the home position.  

(CR)

 
Mnemonic:    (CR)  
Discussion:  Cursor return/carriage return. 
This control code can be used on a video device or a printer. 

Video device
In normal mode, the (CR) control code moves the cursor to the first foreground position on the following line. If the cursor is on the bottom line when this control code is issued, the cursor will be moved to the top line of the screen. In either case, the cursor will land only in a foreground field. 

In typewriter mode, this control code scrolls the screen up one line (forcing the top line off the screen) and will move the cursor to the beginning (left side) of the bottom line on the screen. 

Printer
The (CR) control code performs a carriage return function for the printer. If this control is issued in the middle of a print line, it advances the printer to the beginning of the next line (unlike a line feed control, which would skip the next line and move to the beginning of the following line). 
 
Example (video):  a. 100 FORMAT (CR)
   .
   PRINT (0,100)

b. PRINT (0) (CR)

 
Example (printer):  a. 100 FORMAT "CUSTOMER LISTING";(CR);"PRINTED ON:";DAY$
   .
   OPEN (1) "LP1"
   .
   PRINT (1,100)


b. OPEN (1) "LP1"
   .
   PRINT (1) "CUSTOMER LISTING";(CR);"PRINTED ON:";DAY$

This example prints a heading, performs a carriage return, and then prints a subheading on the next line.
Personal tools