ExtPageControl v2.0 for Delphi and Borland C++Builder ------------------------------------------------------ ExtPageControl is an enhancement of component TPageControl, that comes with Delphi 2 and Borland C++Builder. What are the enhancements of ExtPageControl? =========================================== - You can change the color of active and inactive tabs - Each tab can have a bitmap - You can select different font for active and inactive tabs - Give the TabSheets another background color - Tabs can be placed on top, bottom, the left or right side of the component - A button mode is available if tabs are placed on top. In button mode ExtPageControl becomes borderless. That can be usefully if you want to write wizard-like programs (set property TabVisible to false on all tabsheets). - Define a different Hint for each tab - Disabled TabSheets get a grayed tab-text (as everyone expects on a disabled control) - ExtPageControl establishes a new OwnerDraw style and makes a new event OnDrawTab available. So you can draw the contents of the tabs yourself. Note: To place tabs on left, right or bottom of the component you may need an updated version of Microsofts Common Controls library ComCtl32.DLL. A new version of ComCtl32.DLL ships with Windows NT 4, Windows 97 and Internet Explorer 3. You can download Internet Explorer from Microsofts Web-Site http://www.microsoft.com/ie/download/ Files ===== EXTPAGE.DCR -> component image for Delphi and C++Builder EXTPAGE.DCU -> component for Delphi EXTPAGE.HPP -> include file for C++Builder EXTPAGE.INT -> interface file for user EXTPAGE.OBJ -> component for C++Builder FILE_ID.DIZ -> short information for user ORDER.TXT -> order information for user README.TXT -> this file SAMPLE.DPR -> sample project for Delphi SAMPLE.EXE -> running sample program SAMPLE1.DFM -> sample form for Delphi and C++Builder SAMPLE1.PAS -> sample file for Delphi and C++Builder Installation ============ Installation in Delphi ====================== 1. Copy files EXTPAGE.DCR and EXTPAGE.DCU into a directory, where your components reside, for instance C:\Programs\Delphi2\Lib 2. From the Delphi menu select Component | Install ... 3. Press the Add button, and select the path and filename of EXTPAGE.DCU. In the browse dialog pull down the 'Files of Type' combo box at the bottom and select file type (*.DCU). 4. Back on the Install Components screen press OK. If installation succeeds you should see the ExtPageControl component appear on the Win95 palette. If you have any difficulty installing ExtPageControl refer to the Delphi Help system. Installation in Borland C++Builder ================================== 1. Copy files EXTPAGE.DCR and EXTPAGE.OBJ into a directory, where your components reside, for instance C:\Programs\Borland\CBuilder\Lib\Obj 2. Copy file EXTPAGE.HPP into your include directory, for instance C:\Programs\Borland\CBuilder\Include\VCL 3. From the Borland C++Builder menu select Component | Install ... 4. Press the Add button and select the path and filename of your EXTPAGE.OBJ file. In the browse dialog pull down the 'Files of Type' combo box at the bottom and select file type (*.OBJ). 5. Back on the Install Components screen press OK. If installation succeeds you should see the ExtPageControl component appear on the Win95 palette. If you have any difficulty installing ExtPageControl refer to the Borland C++Builder Help system. Registration ============ ExtPageControl is Shareware since v2. A free Trial version gives you the opportunity to try this native component. It has the full functionality of the registered version, but can run only when Delphi or Borland C++Builder is also running on the PC. To deliver an application using this component, you must purchase the applicable version. The registration fee is US $24.95. You get full source code and lifetime technical support via Compuserve and Internet. We will send the source code to your e-mail address. Please see file Order.txt for details. FAQ ==== Q: Is it possible to have each tab a different color? A: Yes, simply insert some code in event OnDrawTab. In Delphi write: with TExtPageControl(Control) do begin Case Index Of 0: Canvas.Brush.Color:= RGB(192, 220, 192); // color of Tab 1 1: Canvas.Brush.Color:= clYellow; // color of Tab 2 2: Canvas.Brush.Color:= RGB(166, 202, 240); // color of Tab 3 End; Canvas.FillRect(RectBg); DefaultDrawTab(Index, RectFg, State); end; Check if unit StdCtrls is included in the uses clause of your file. In C++Builder you can write: TExtPageControl *ExtPgCtrol = (TExtPageControl*)Control; switch(Index) { case 0: // color of Tab 1 ExtPgCtrol->Canvas->Brush->Color = RGB(192, 220, 192); break; case 1: // color of Tab 2 ExtPgCtrol->Canvas->Brush->Color = clYellow; break; case 2: // color of Tab 3 ExtPgCtrol->Canvas->Brush->Color = RGB(166, 202, 240); break; }; ExtPgCtrol->Canvas->FillRect(RectBg); ExtPgCtrol->DefaultDrawTab(Index, RectFg, State); Q: How do you go about changing the lettering color of one tab? Lets say you have five tabs, all the tabs have gray background and black lettering which is the norm. One of the tabs need to stand out and be a different color (just for the letters), the background would remain the same. A: In Delphi insert this code in event OnDrawTab: with TExtPageControl(Control) do begin Case Index Of 0: Canvas.Font.Color:= clNavy; // blue text on Tab 1 1: Canvas.Font.Color:= clRed; // red text on Tab 2 2: Canvas.Font.Color:= clGreen; // green text on Tab 3 End; DefaultDrawTab(Index, RectFg, State); end; Check if unit StdCtrls is included in the uses clause of your file. In C++Builder insert this code in event OnDrawTab: TExtPageControl *ExtPgCtrol = (TExtPageControl*)Control; switch(Index) { case 0: // blue text on Tab 1 ExtPgCtrol->Canvas->Font->Color = clNavy; break; case 1: // red text on Tab 2 ExtPgCtrol->Canvas->Font->Color = clRed; break; case 2: // green text on Tab 3 ExtPgCtrol->Canvas->Font->Color = clGreen; break; }; ExtPgCtrol->DefaultDrawTab(Index, RectFg, State); Q: I currently have a PageControl that is about 8 pages big with a lot of controls on each page. Is it possible to substitute ExtPageControl with PageControl without starting from scratch. I tried the cut and paste routine along with all the source but its a real pain and not working to well. A: Select your form in design-mode. Press keys ALT+F12 -> you should be in form-edit mode now. Search for your TPageControl and replace it by TExtPageControl. Press ALT+F12 again and save your work. This works the same way in Delphi and Borland C++Builder. Q: I have tried out the ExtPageControl, and it works very well except for one particular area where I think you have a bug. If I place a 'Button' on the form with the following procedure: Page2.TabVisible := False; You will see that the tabsheet is removed, while the tab itself is wrong. Instead of removing 'Tab2', 'Tab3' is actually removed. A: Confirmed, this was a bug and has been fixed in version 1.4d. Q: How do I get bitmaps into the tabs? How do I use property TabGlyphs? A: All images for the different tabs are stored in one large bitmap (property TabGlyphs.Glyph). All images must be the same size and next to each other in a horizontal row. You must specify the number of images that are in the bitmap with the TabGlyphs.NumGlyphs property. If you have for instance 5 tabs in your ExtPageControl and each tab image has a height of 18 pixel and a width of 16 pixel, then the bitmap must be 18 pixel high and 5*16 = 80 pixel wide. Set property TabGlyphs.NumGlyphs to 5. You can create the bitmap with any bitmap editor. With Delphi and Borland C++Builder comes an ImageEditor (imagedit.exe). Property TabGlyphs.TransparentColor determines partial transparent parts in the image. Property TabGlyphs.Spacing determines the number of pixels between the image (specified in the Glyph property) and the text (specified in the Caption property of each TabSheet). The default value is 5 pixels. By the way, you can always switch between the pages of a PageControl by pressing the keys CTRL + TAB. Pressing CTRL + SHIFT + TAB switches back. These shortcuts work system wide with all PageControls. Jan - Michael Strube e-mail: 100333.2744@compuserve.com WWW: http://ourworld.compuserve.com/homepages/praxisservice/