TMsgBox – Documentation Overview This component is a replacement for the ShowMessage and MessageBox functions. It has a lot of new and extended features ? Custom AVI’s can be displayed (Have to be included with either a resource file or specify a file name) ? Predefined and custom Images (There are currently 4 images predefined: mbAsk, mbInfo, mbWarn, mbError) ? Predefined and custom buttons (6 button combinations are predefined for compatibility to MessageBox’). You can specify up to 15 buttons (that is quite enough I think ?). The buttons are specified as TStringList ? 4 different display positions (apCustom,apDefault,apParentCenter,apScreenCenter) ? Easy usage just do an Execute(this) and the number of the clicked button will be returned Requirements You need Borland C++ Builder (Version 1.0 will do). Sorry, but Delphi will not work because the component is written entirely in C++. You can use MsgBox with either Window 95 (98) and NT (4.0, 5.0). Installation Copy the files located in the installation path MsgBox.obj MsgBox.dcr MsgBox.h XIC.res to the place where you store your VCL classes. >From inside C++ Builder select menu component and then install. Select MsgBox as new component and then rebuild the library. Done. Copyright TMsgBox is Shareware. If you have registered you have the permission to use the component in all non commercial (Shareware, Cardware or something similar) software or package. You may not give this component to any other person. If you want to use the component in commercial a software package please contact the author for special conditions and package licenses. For non-commercial use only: The price for the component is 10$ (cash only). Delivery is done via email only. Send you registration the product you want to buy and the cash to the following address: Hans-Peter Guenther Glockenblumenweg 17 34128 Kassel Germany You will receive the component as object code and the header as .h file and the documentation in Microsoft Word and text file format. Also you got an example C++Builder project which demonstrates the use of TMsgBox. You got also free updates and technical support for one year. Usage Use the component like any other component. Add it at design time to any form. Set the appropriated properties with the object inspector. Component TMsgBox – class documentation Properties: ? ButtonStyles enum MsgButtonStyles ButtonStyles – specify whether the MsgBox should display one of the predefined button combinations or the given ButtonTexts. MsgButtonStyles are defined as follows: enum MsgButtonStyles { btsAbortRetryIgnore, btsOk, btsOkCancel, btsRetryCancel, btsYesNo, btsYesNoCancel, btsCustom }; btsAbortRetryIgnore btsOk (default) btsOkCancel btsRetryCancel btsYesNo btsYesNoCancel these are predefined combinations also found by the WINAPI MessageBox function. Included here for compatibility only. btsCustom this option tells MsgBox to use the ButtonTexts defined by the user. ? Appearance enum Appearences Appearance – this defines where the MsgBox should be opened at. Appearences is specified as follow: enum Appearences { apCustom, apDefault, apParentCenter, apScreenCenter }; apCustom the MsgBox will be opened at the position specified with the FormLeft and FormTop properties. Note: These positions are absolute positions apDefault the MsgBox will be opened at the default position , this means the system decides where the window should appear. apParentCenter the MsgBox will be opened centered on the control or form which is given as parameter to the Execute method apScreenCenter (default) the MsgBox will be opened screen centered. ? Type enum MsgBoxTypes Type – this specifies which kind of Image or AVI should be displayed MsgBoxTypes are specified as follows: enum MsgBoxTypes { mbAsk, mbInfo, mbWarn, mbError, mbCustom }; mbAsk mbInfo mbWarn mbError these values are predefined Images for compatibility with the WINAPI MessageBox function only. mbCustom If you have specified a CustomImage or either an AVIResourceName, AVIResourceID or AVIFile the AVI will be displayed. ? ButtonTexts TStringList ButtonTexts If the ButtonStyles property is set to btsCustom the ButtonTexts will be used as ButtonTexts. Each line represents a button. The buttons are displayed in the correct order. You may specify a shortcut for each button with a leading ‚&‘ of the ButtonCaption i.e. &Start will underline the S. Alt-S will be the shortcut to the „Start“-button. ? Lines TStringList Lines - These are the lines which should be displayed inside the MsgBox. ? Caption AnsiString Caption – This is the title of the MsgBox window. ? CustomImage Graphics::TBitmap *CustomImage – This is the Image which will be displayed if the Type is set to mbCustom. Note: Any definition of an AVI file will be cleared if you specify this. ? FormLeft, FormTop int FormLeft, FormTop – These properties are the positions the MsgBox will be opened if the Appearance property is set to apCustom. ? DefButton int DefButton – This value decides which button is initially focused when the MsgBox appears. If you do not specify a value here the first button will be the default. DefButton can be any value between 1 and where 0 stands for the default 1st button. ? Result int Result – Only at runtime and read only. This is the ButtonID which was clicked last the MsgBox appeared. If the MsgBox has not been showed the value is set to 0 else the value is between 1 and . ? AVIResourceID int AVIResourceID – this is the Resource integer which represents the AVI in the resource file you want to be displayed left beneath the text. The AVI will be only displayed if the Type property is set to mbCustom. Note: This property is runtime only and displays an error when you try to set this at design time ? AVIResourceName AnsiString AVIResourceName – this is the Resource name which represents the AVI in the resource file you want to be displayed left beneath the text. The AVI will be only displayed if the Type property is set to mbCustom. Note: This property is runtime only and displays an error when you try to set this at design time ? AVIFile AnsiString AVIFile – this is the full or relative path to the AVI file which should be displayed. The AVI will be only displayed if the Type property is set to mbCustom. ? TransparentColor TColor TransparentColor – If you specify a CustomImage to display this option can be used to define the transparent of the bitmap. Usually TMsgBox will use the first pixel locates at the upper left corner of your bitmap as transparent color. If this is not set the TransparentColor to the transparent color of your image. Methods: ? __fastcall TMsgBox(TComponent* Owner); standard VCL constructor ? int __fastcall Execute(TWinControl *ParArea); This function shows the MsgBox application modal. If the Appearance property is set to apParentCenter the MsgBox will appear centered in the ClientArea of ParArea else this parameter is ignored. The function returnes the index of the clicked button started by 1 to . If the function returns 0 or –1 an error has occurred. Author If you have any questions, suggestions or want to contact me send a message to the following address: hpgue@aol.com Visit also my home page at http://members.aol.com/hpgue/hpgintl.htm ___