Changes to existing Statements and Functions

· | #COMPILE metastatement has been enhanced to support compiling of Static Link Libraries.

· | %DEF operator has been expanded so that %PB_EXE returns false when compiling a Static Link Library.

· | ARRAY DELETE and ARRAY INSERT statements now supports Variants, Objects, Guids, and UDT arrays.

· | ARRAY SORT now uses CALL instead of USING when specifying a custom array sort function.

· | ASC function has been improved to support Unicode as well as ANSI strings.

· | ASC statement has been improved to support Unicode as well as ANSI strings.

· | ASMDATA DD now supports sign-extended values.

· | BIN$ function has been expanded to 64-bits with formatting and now supports adding leading and trailing spaces to the string result.

· | CALL statement offers automatic conversion of numeric, string, and UDT parameters to variant parameters.

· | CHOOSE, CHOOSE&, and CHOOSE$ functions have been enhanced with optional ELSE clause. The ELSE option allows an optional choice value to be returned when no match is made. For example:

ChoiceVar$ = CHOOSE$(7,"ONE", "TWO" ELSE "NUL")

In this case, the ELSE expression "NUL" is returned.

CHOOSE and CHOOSE& also support an optional BIT clause where the selection is based upon the first bit set (lowest to highest) in the specified index. This is particularly valuable when used with an ENUMERATION which also uses the BIT option, to describe a set of attributes for an item in your program.

The CHOOSE$ function now has an optional BITS clause that works in the same general fashion as the BIT clause, except the function may return multiple choices, as a concatenated string, if more than one bit is set. For example:

x$ = CHOOSE$(BITS 5, "Computer ", "Laptop ", "Desktop ")

Since the value 5 consists of 2 bits (the lowest and third-lowest) set, the first and third strings are concatenated and returned to the caller. In this case, "Computer Desktop " is the result.

· | CLIPBOARD GET TEXT statement automatically converts the retrieved string to ANSI or Unicode to match the format of the target variable.

· | CODEPTR function has been improved to return the address of a FASTPROC.

· | COMBOBOX ADD and COMBOBOX INSERT statements now offer an optional TO clause that returns the index position of the added string.

· | COMM function, COMM LINE, COMM OPEN, COMM PRINT, COMM RECV, COMM SEND, and COMM SET have been expanded to support ANSI and Unicode strings. COMM LINE, COMM OPEN, COMM PRINT, COMM RECV, and COMM SEND have been improved with an optional timeout (see COMM TIMEOUT) to complete the given COMM operation.

· | CONTROL ADD GRAPHIC statement. Graphic controls may now be resized with CONTROL SET CLIENT, GRAPHIC SET CLIENT, CONTROL SET SIZE, or GRAPHIC SET SIZE.

· | CONTROL SET CLIENT statement now resizes graphic controls.

· | CONTROL SET FONT statement resets back to the default original font chosen by PowerBASIC when a font handle of zero is specified.

· | CONTROL SET SIZE statement has been enhanced to support graphic controls.

· | DECLARE statement has been updated to support the COMMON and THREADSAFE descriptors. A COMMON Sub or Function is one which may be referenced by and between linked unit modules (Main or SLL). With the THREADSAFE option, PowerBASIC automatically establishes a semaphore which allows only one thread to execute the Sub/Function at a time. Other callers must wait until the first thread exits the THREADSAFE procedure before they are allowed to begin.

· | DIR$ function now supports Unicode file names and directories. The DIRDATA built-in UDT has been updated to return Unicode short and long filenames.

· | EXIT statement has been improved to support exiting a FASTPROC immediately.

· | FONT NEW statement now optionally supports creating fonts with external leading.

· | FUNCTION/END FUNCTION statements have been expanded to support an optional THREADSAFE descriptor. With the THREADSAFE option, PowerBASIC automatically establishes a semaphore which allows only one thread to execute the procedure at a time.

· | GET$ statement reads ANSI string data from a file opened in binary mode, but if the data is read into a Unicode string it will be converted to Unicode before it is assigned.

· | GRAPHIC COLOR statement now supports parameters of -3 to indicate that the existing color should not be changed.

· | GRAPHIC GET CLIENT statement now returns the client area size in dialog units or pixels only. The size represents the physical size of the display area on the screen. This change was necessary because of the improved graphic functionality involving virtual windows, resizing of graphic windows, etc. Prior versions returned scaled sizes if a GRAPHIC SCALE was executed. Substitute GRAPHIC GET CANVAS for functionality which is fully compatible with the old format.

· | GRAPHIC GET LOC and GRAPHIC SET LOC now only support Graphic Windows. For Graphic Controls use CONTROL GET LOC and CONTROL SET LOC.

· | GRAPHIC SET FONT statement resets back to the default original font chosen by PowerBASIC when a font handle of zero is specified.

· | GRAPHIC PRINT statement has been expanded to support POS(), SPC(), TAB(), commas, and semicolons. The POS(n) clause is an optional function used to set the POS to the horizontal page unit. Multiple uses of the POS function is permitted in a single statement. The SPC(n) clause is an optional function used to insert n spaces into the printed output. Multiple use of SPC is permitted in a single statement. The TAB(n) clause is an optional function used to tab to the n th column before printing the next expression. Multiple use of TAB is permitted in a single statement.

· | GRAPHIC RENDER statement now supports icons as well as bitmaps.

· | GRAPHIC WAITKEY$ statement has been improved with a optional KeyMask$ and TimeOut& expressions. If the optional KeyMask$ expression is included, only a limited set of keys are recognized. KeyMask$ may include any number of Sub-Masks, one for each key to observe. For example, GRAPHIC WAITKEY$("YyNn") will recognize upper-case or lower-case Y or N (for yes/no answers), while any other key will be ignored. If KeyMask$ is omitted, or evaluates to a zero-length string, any key event will be recognized. If the optional TimeOut& expression is included, it tells the maximum number of milliseconds to wait for a key. GRAPHIC WAITKEY$(5000) will wait a maximum of 5 seconds. The specified TimeOut period will only be approximate, so you should not rely upon precision accuracy. If the TimeOut period is exceeded, a zero-length string is returned. If the TimeOut& parameter is omitted, or evaluates to zero (0), it will wait an infinite length of time.

· | GRAPHIC WINDOW statement has been expanded to support an optional font handle of the initial font to be used in the GRAPHIC WINDOW.

· | GRAPHIC WINDOW END statement has been enhanced with an optional handle of the graphic window to close.

· | HEX$ function now supports adding leading and trailing spaces to the string result.

· | IPowerTime.DateDiff now reports invalid parameters through OBJRESULT.

· | IPowerTime.TimeDiff now reports invalid parameters through OBJRESULT.

· | IPowerTime.NewDate now reports invalid parameters through OBJRESULT.

· | IPowerTime.NewTime now reports invalid parameters through OBJRESULT.

· | LET statement (with Types) has been expanded to support assigning a Variant byte string to a UDT using the Variant$ function.

· | LISTBOX ADD and LISTBOX INSERT statements now offer an optional TO clause that returns the index position of the added string.

· | MENU ADD POPUP statement has been expanded with an optional AS id& clause. id& is a unique numeric identifier for this popup menu. id& may be used later with a BYCMD option to reference this popup.

· | MENU GET STATE statement has been enhanced to support the %MFS menu states equates.

· | MENU SET STATE statement has been enhanced to support the %MFS menu states equates.

· | METHOD/END METHOD statements have been expanded to support an optional THREADSAFE descriptor. With the THREADSAFE option, PowerBASIC automatically establishes a semaphore which allows only one thread to execute the procedure at a time.

· | MID$ function and MID$ statement now support both a starting and ending position.

· | OCT$ function has been expanded to 64-bits with formatting and now supports adding leading and trailing spaces to the string result.

· | OPEN statement has been improved with the CHR clause. The CHR clause specifies the character mode for this file: ANSI or WIDE (Unicode). Since sequential files consist of text alone, the selected mode is enforced by PowerBASIC. All data read or written to the file is automatically forced to the selected mode, regardless of the type of variables or expressions used. With binary or random files, this specification has no effect, but it may be included in your code for self-documentation purposes.

· | PATHNAME$ function has been enhanced to accept relative path names.

· | POKE statement now supports multiple data items to be stored successively.

· | PROPERTY/END PROPERTY statements have been expanded to support an optional THREADSAFE descriptor. With the THREADSAFE option, PowerBASIC automatically establishes a semaphore which allows only one thread to execute the procedure at a time.

· | PUT$ statement has been expanded to support Unicode string expressions. If string expressions result is a Unicode string, it is converted to ANSI byte characters.

· | SELECT CASE/END SELECT block has been improved with the CONST$$ modifier to enhance performance when the controlling expression is Unicode.

· | SUB/END SUB statements have been expanded to support an optional THREADSAFE descriptor. With the THREADSAFE option, PowerBASIC automatically establishes a semaphore which allows only one thread to execute the procedure at a time.

· | TOOLBAR ADD SEPARATOR statement has been improved with an optional unique numeric identifier. This identifier may be used later with a BYCMD option in TOOLBAR DELETE, TOOLBAR SET STATE, etc.

· | TRIM$ function has been expanded to take a numeric expression and convert it to a string without any leading or trailing spaces along with an option specify the maximum number of significant digits.

· | UCODEPAGE statement now supports the OEM code page. By default, the system ANSI code page, is used to map the character translation. If you are compiling a CONSOLE application or one which makes use of the high-order ANSI codes, CHR$(128) through CHR$(255) for line drawing and a few international characters, you should declare an OEM code page by placing UCODEPAGE OEM at the start of your PBMain function.

· | VAL function has been enhanced with an optional parameter to specify the position in the string where the conversion should begin.

· | VARIANT$ and VARIANT$$ used to return strings based on the contents of the variant. VARIANT$ now assumes the contents of the variant is a wide Unicode string and converts it to a ANSI string. VARIANT$$ assumes the contents of the variant is a wide Unicode string and returns the contents directly as a wide Unicode string. VARIANT$(BYTE, VrntVar) always returns the contents as an ANSI byte string. This result can be assigned to an ANSI string variable or a User-Defined Type.

· | XPRINT ATTACH CHOOSE statement has been expanded to support optional numeric expression to control the execution of the Printer Dialog.

· | XPRINT COLOR statement now supports parameters of -3 to indicate that the existing color should not be changed.

· | XPRINT PRINT statement has been expanded to support POS(), SPC(), TAB(), commas, and semicolons. The POS(n) clause is an optional function used to set the POS to the horizontal page unit. Multiple uses of the POS function is permitted in a single statement. The SPC(n) clause is an optional function used to insert n spaces into the printed output. Multiple use of SPC is permitted in a single statement. The TAB(n) clause is an optional function used to tab to the n th column before printing the next expression. Multiple use of TAB is permitted in a single statement.

· | XPRINT SET FONT statement resets back to the default original font chosen by PowerBASIC when a font handle of zero is specified,

See Also

New Statements and Functions

New in the IDE

Additional Changes