home *** CD-ROM | disk | FTP | other *** search
- I wrote this unit as an initial error handler for Turbo Professional's BTree
- Filer. It contains all of the error messages from the documentation, including
- those from the ReadMe file. The procedure will pop up an error window at a
- specified position, and display an error message corresponding to those in
- Btree Filer manual. The window remains on screen until a key is pressed.
- The screen is then restored. This unit performs no error handling whatsoever.
- That is your responsibility.
-
- The interface section of the unit contains one procedure, DisplayErrorMsg.,
- as presented below.
-
- PROCEDURE DisplayErrorMsg(ErrorNumber: Integer;
- Col,row: ShortInt;
- WinAttr,
- FrameAttr,
- HeaderAttr: Byte);
-
- The required parameters are as follows:
-
- ErrorNumber should be passed IsamError. This is the number
- Btree Filer returns when an error occurs.
-
- Col,Row are the upper left hand corner where you want the
- message window to appear.
-
- WinAttr,FrameAttr,HeaderAttr are the attributes for the Window,
- Frame and header.
-
- The values passed for the attributes correspond to those for the text
- attribute byte in Turbo pascal. The background color is contained in bits 4-6,
- the foreground in bits 0-3. To set the colors, look at the TextColor and
- TextBackground procedures in the Turbo Pascal manual. Multiply the background
- color you want by 16, and add the foreground color. For a blue background with
- white letters, this would be:
-
- Background color Blue = 1 x 16 = 16
- Foreground Color white = 15
- ----
- 31
- You would set the appropriate attribute to 31.
- A red background with white letters would be 79 (4 x 16 + 15) and so on.
-
- The size of the window is between 40 and 50 characters wide. The number of rows
- depends on the length of the error message. The WordWrap routine from Turbo
- Professional is used to break the message into lines. The width of the message
- box is determined by the length of the longest line. The height is based on the
- number of lines in the message.
-
- The messages themselves are stored in .obj format, and are extracted by a
- routine adapted from the Turbo Editor Toolbox. (Not required to compile.) This
- unit does requires Turbo Professional 5.0 toolbox to compile. It uses TpWindow,
- TpString and TpCrt.
-
- The .PAS file, TestErr, calls this unit and displays one of the messages.
- Feel free to use this to test the unit, or modify it for your program.
-
- This is the first version of the unit, and is intended more for development
- rather than full use in a system. Many of the messages would not be displayed
- in a normal user environment, but I have found them useful in development.
-
- The error message routine using the editor toolbox techniques Ihave found to
- be extremely useful, especially when a program contains a lot of text. By
- storing the text in .obj format, you avoid typed constants and a lot of wasted
- space. I use it frequently.
-
- If you would like to receive the source code for this unit, please send $25.00
- to: Robert Galivan & Associates
- 7700 N. Kendall Dr. Suite 200
- Box 16-1127
- Miami, FL 33116.
- (305) 270-1540
-
- I will send a copy of the source on disk, along with full documentation.
-
- I would appreciate your comments as well, either to the above address, or
- on compuserve, 71250,71. Enjoy!
-