The text of a manual · part 12 of 17
Apex III / Apex IV Technical Reference Manual, Second Edition, pages 111 to 120
Pages 111 to 120 of 168
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Compsee Apex III and Compsee Apex IV
Page 111
Apex PDT Technical Reference Manual
7 Apex Programming Resource
Get Text apifGetText Syntax:
Input:
rslt = apifGetText(Enabled, Row, Col, Data$, MaxLen, MinLen, PromptLen, DataType, AutoEnter, Scan/Key, PadChr$, PWChr$, Justify, Mask$, FrstChr$, LastKey) Enabled = %YES or %NO. If enabled in %NO the data entry capability is turned off and the function reads like apisPaintText. Row = Row to start the data entry. Col = Column to start the data entry. Data$ = Can be set to NULL or can contain data. If Data$ contains information, then the data is displayed and the user must backspace to clear the field. MaxLen = The maximum length of the data allowed in this field. MinLen = The minimum length of the data allowed in this field. PromptLen = The size of the display prompt. If MaxLen is greater than PromptLen, then the data will scroll within the defined display field. DataType = %NUMERIC, %ALPHA, or %BOTH. AutoEnter = %YES or %NO. Automatically accepts the data once the MaxLen is reached. Scan/Key = %SCANDATA, %KEYDATA, or %KEYANDSCAN. PadChr$ = The character used to pad data to the MaxLen. If “”, then a space is automatically used. PWChr$ = If unequal to “”, then PWChr$ is displayed instead of data. Justify = %Ljustify, %Rjustify, or %None. If %None, then padding is turned off. Mask$ = Allows the user to mask the input field. [# (0-9), @ (Aa-Zz and space), ^ (0-9, Aa-Zz, and space), ~ ($%&() etc.), or the user can enter a specific character. If the user puts a space in the mask, then the routine uses DataType% for that character. FrstChr$ = Allows the user to specify the first character. e.g. An “A” ⇒ first character must be an A, “ABCDE” ⇒ first character must be ABCD or E. LastKey = Returns the value of the last key pressed.
COAM30002
Rev. 2.00
8/13/02
7-3
Page 112
Apex PDT Technical Reference Manual
7 Apex Programming Resource apifGetText continued Input:
Returns:
Notes:
Additional Parameters (Global Variables): apiMaskInput$[] = Array used to mask ranges in data. Format: SSEETRR.. SS = Starting position. EE = Ending position. T = Test (1-<, 2-<=, 3-=, 4->, 5-=>) RR = Range – the size depends on the range. e.g. Range = 9, then Len = 1; Range = 999, then Len = 3. apiTotMaskInput% = Number of elements in apiMaskInput$[] OK = Valid field character, but field is not complete. NULL = Not a valid field character. ERROR = An error has been found in the data. DONE = Data has been entered and is valid. This data entry routine initiates a return after every key press. The user must monitor the return status to know what action to perform next. This allows the user to branch or perform tasks on a specific key or to perform validation checks that immediately notify the user as the data is being entered.
Alarm Message apisAlarmMessage Syntax: Input:
Returns: Notes:
7-4
ApisAlarmMessage(Msg$, Row, Col, Delay, Beep, Key) Msg$ = Message that can contain several lines of text. The function looks for | to determine where to set line breaks. Row = Horizontal position on the screen. Column = Vertical position on the screen. Delay = Time (sec.) to display error message. Only active if Key = %NO. Beep = %YES or %NO. Calls apisErrorBeep if active. Key = %YES or %NO. Ignores a Delay and looks for a key to be pressed to continue. None Clears the current screen, displays the specified error message, beeps and waits for a specific key to be pressed or delay time to be reached, after which the previous screen is refreshed.
COAM30002
Rev. 2.00
8/13/02
Page 113
Apex PDT Technical Reference Manual
7 Apex Programming Resource
Error Beep apisErrorBeep Syntax:
apisErrorBeep()
Input: Returns: Notes:
None None Sounds a series of beeps.
Restore Screen apisRestoreScreen Syntax:
apisRestoreScreen(File Name$)
Input:
FileName$ = Filename from which to restore current screen. None
Returns: Notes:
Restores the current screen from a file. This function is used in conjunction with apisSaveScreen().
Get Key apisGetKey Syntax: Input: Returns: Notes:
apisGetKey() None The value of a keypress. Rslt$ = Value of a keypress as a string. e.g. “A” = 65 Automatically adds 200 to the value of an extended key. e.g. F1 = 259 (Vs 59, normally a “;”). If the scanner is ON and in Wedge Mode and a bar code is scanned the function will crash.
COAM30002
Rev. 2.00
8/13/02
7-5
Page 114
Apex PDT Technical Reference Manual
7 Apex Programming Resource
Key Scan apifKeyScan Syntax:
Rslt$ = apifKeyScan()
Input: Returns: Notes:
None Rslt$ = Value of a keypress as a string. e.g. “A” = 65 Waits until a key is pressed or a bar code is scanned. When a key is pressed, returns the value of the key. Returns 999 when a barcode is scanned.
Exist apifExist Syntax:
apifExist(FileName$)
Input: Returns:
FileName = Filename to be verified. 1 if the file exists, 0 if the file does not exist or is not found. Checks to see if a designated file exists.
Notes:
File Setup apisFileSetup Syntax:
Calls apisFileSetup(FileName, Fields(), FieldCount)
Input:
FileName = Filename that is to be used to store data. Fields() = Two dimensional array containing field name and field length. FieldCount = Number of Fields() in the array. None Used to create a definition file (FileName.AFD). AFD files are used by all file routines.
Returns: Notes:
7-6
COAM30002
Rev. 2.00
8/13/02
Page 115
Apex PDT Technical Reference Manual
7 Apex Programming Resource
File IO apifFileIO Syntax: Input:
Returns: Notes:
Rslt$ = apifFileIO(FileName, Fields(), FieldCount, Function, RecordNumber) FileName = File to be used. Fields() = Two dimensional array containing fieldname and length. The user fills this array with the appropriate data when performing an append or update. When performing a read, the function returns the data in the array. When performing a delete, the function is not utilized. Fields() may be entered into the array in any order. The .AFD file is used to properly format the record. FieldCount = Number of fields in the array Function = apiRead, apiAppend, apiUpdate or apiDelete RecordNumber = Used only when performing a Read or Update. “OK” or “ERROR” Performs four (4) input/output (I/O) functions; append, update, read, and delete. Uses the FileName.AFD to obtain the file structure.
Records In File apifRecsInFile Syntax:
Rslt$ = apifRecsInFile(FileName)
Input:
FileName = Filename that is to be used.
Returns: Notes:
Present number of records in the designated file. Obtains the record size and calculates the number of records in the file by reading the FileName.AFD file.
COAM30002
Rev. 2.00
8/13/02
7-7
Page 116
Apex PDT Technical Reference Manual
7 Apex Programming Resource
File Info apifGetInfo Syntax:
Rslt$ = apifGetInfo(FileName, Fields())
Input:
FileName = Filename that is to be used. Fields() = File structure is returned in this array. function is used by all File IO (Input/Output) routines. −1 if file does not exist.
Returns: Notes:
The
File structure is returned in Fields(). Used to read the FileName.AFD file and return the file structure for the FileName.
Search apifSearch Syntax:
Rslt$ = apifSearch(FileName, KeyField1, Value1, KeyField2, Value2, Record, CurrentField)
Input:
FileName = File to searched. KeyField1 = First field to be searched. Value1 = Value of the first field to be searched. KeyField2 = Second field to be searched. Value2 = Value of the second field to be searched. Record = Record number to start the search. CurrentField = (YES/NO) If YES only the current record is searched. −1 if an error was received. 0 if no matches were found or the record number of the first occurrence. Performs a sequential search and returns the first occurrence of the key field.
Returns: Notes:
7-8
COAM30002
Rev. 2.00
8/13/02
Page 117
Apex PDT Technical Reference Manual
7 Apex Programming Resource
Error Trap apisErrorTrap Syntax:
CALL apisErrorTrap()
Input: Returns: Notes:
None None A generic error trapping routine used with the ONERROR function.
Transfer/Receive String apifSendRefString Syntax:
Rslt$ = apifSendRefString(Port, Text$, Direction)
Input:
Port = apiRS232 (RS-232 port) or apiIR (IR port) Text$ = Text to be sent or received via designated Port. Direction = apiSend (sends identified string to PC or other serial device) or apiRecv (Apex PDT receives a string). –1 if the user aborts before text is sent. Used to send or receive a string through the Apex PDT RS-232 port or the IR port.
Returns: Notes:
Clear File apisClearFile Syntax:
Call apisClearFile(FileName
Input: Returns: Notes:
FileName = File to be cleared. None Removes all data from the specified file.
COAM30002
Rev. 2.00
8/13/02
7-9
Page 118
Apex PDT Technical Reference Manual
7 Apex Programming Resource
C Library The Apex Programming Resource (APR) contains a C Library (APR-C) suitable for inclusion with small, compact, medium, and large memory model Borland C or Microsoft C programs. The C Library files along with the associated include file shown below can be found on the Compsee Product Support CD supplied with the unit.
Model Type Small Compact Medium Large
Microsoft C Filename [a3mscs.lib] [a3mscc.lib] [a3mscm.lib] [a3mscl.lib]
Borland C Filename [a3bcs.lib] [a3bcc.lib] [a3bcm.lib] [a3bcl.lib]
Include Filename [a3lib.h] for all model types
Table 7-1: APR-C File Information
The C Library, separated into functional areas, contains the following functions:
Internal Speaker Functions Beep Syntax: Input: Returns: Notes:
void Beep(unsigned int frequency, unsigned int duration) frequency in hertz (Hz), duration in milliseconds. None Turns on the internal speaker at a given frequency for a given duration. If frequency is 0, Beep() doesn't try to make a sound. It just delays for the duration.
BeepError Syntax:
void BeepError(void)
Input: Returns: Notes:
None None Issues a series of beeps through the internal speaker to indicate an error condition.
7-10
COAM30002
Rev. 2.00
8/13/02
Page 119
Apex PDT Technical Reference Manual
7 Apex Programming Resource
BeepOn Syntax:
void BeepOn(unsigned int hertz)
Input: Returns: Notes:
Frequency of the sound in hertz. None Turns on the internal speaker at a given frequency (hertz). To turn the speaker off after this function, call the function BeepOff().
BeepOff Syntax: Input:
void BeepOff(void) None
Returns: Notes:
None Turns the speaker off after it has been turned on by a call to BeepOn().
BeepVolume Syntax: Input:
Returns: Notes:
char BeepVolume(unsigned char level) VOL_OFF, VOL_LOW, VOL_MED, VOL_HIGH corresponding to Off, Low, Medium, and High volume settings. Symbolic constants are defined in [a3lib.h]. Previous setting on success, -1 on error Sets the Apex PDT beeper volume. This function returns an error if attempted on BIOS's prior to v1.34.
Screen (Display) Functions GetTextSize Syntax:
int GetTextSize(void)
Input: Returns:
None TEXT_8X16, TEXT_8X8, TEXT_16X8, TEXT_16X16, on success (symbolic names are defined in [a3lib.h]). −1 if attempted in non-text mode. Determines the current font size.
Notes:
COAM30002
Rev. 2.00
8/13/02
7-11
Page 120
Apex PDT Technical Reference Manual
7 Apex Programming Resource
SetTextSize Syntax: Input:
Returns: Notes:
int SetTextSize(int size) size = TEXT_8X16, to change to 8 × 16 font TEXT_8X8, to change to 8 × 8 font TEXT_16X8, to change to 16 × 8 font TEXT_16X16, to change to 16 × 16 font (symbolic names are defined in [a3lib.h]) Previous setting. Changes the displayed font size and sets the window size accordingly. SetTextSize() clears the screen.
GetCursorPosition Syntax: Input:
Returns: Notes:
void GetCursorPosition(struct textcoord *cursor) The textcoord structure, declared in [a3lib.h], contains the following elements: short row; short col; None Loads the structure with the current cursor coordinates (row, col). The text position given by the coordinates (1, 1) is defined as the upper-left corner of the text window.
SetCursorPosition Syntax:
void SetCursorPosition(short row, short column)
Input: Returns: Notes:
Cursor coordinates. None Sets the current text position to the displa y point (row, column). The text position given by the coordinates (1, 1) is defined as the upper-left corner of the text window.
7-12
COAM30002
Rev. 2.00
8/13/02