Home SpTBXLib VELVEx MultiInstaller Skin Editor

Support

The discussion on SpTBXLib package as well as other Toolbar2000 extensions is hosted by Jordan Russel's news server at: jrsoftware.toolbar2000.thirdparty (web based). Please, address general questions to the newsgroup.

Direct e-mail contact:

For information on Toolbar2000 components, visit http://www.jrsoftware.org

License

Use and/or distribution of the files requires compliance with the SpTBXLib License, found at:
SpTBXLib-LICENSE

Alternatively, at your option, the files may be used and/or distributed under the terms of the Mozilla Public License Version 1.1, found at:
http://www.mozilla.org/MPL

Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.

The initial developer of this package is Robert Lee.

Do I need to register?

Registration is required only if you choose the SpTBXLib License which allows you to not include an acknowledgement in your application's about box or help file, and also allows you to keep the modifications you've made to SpTBXLib without having to make them public.
To register click here.

No registration is required if you choose to use SpTBXLib under the Mozilla Public License Version 1.1.
However, if you wish to express your appreciation for the time I spend on developing, documenting and supporting it, I do accept and appreciate donations.
To donate click here.

Thank you for your support.

Installation

Requirements:

To install SpTBXLib manually:

  • Install TB2K and apply TB2K patch
  • If you have a previous version of SpTBXLib installed in the IDE remove it from Component->Install Packages, select SpTBXLib from the list and press the Remove button.
  • Add the SpTBXLib 'Source' directory to:
    Tools->Options->Language->Delphi->Library->Library Path
  • Open the SpTBXLibDsgn_*.dpk design package corresponding to the IDE version, press Compile and then press Install, close the package window (don't save the changes).

To install SpTBXLib with Silverpoint MultiInstaller:

  • Create a new folder for the installation
  • Download all the component zips to the created folder: SpTBXLib + TB2K
  • Download Silverpoint MultiInstaller
  • Download a premade Setup.ini for the installation or create one from a template. In this example we are going to use this Setup.Ini file, unzip it in the folder.

The installation folder will end up with this files:

C:\MyInstall
       |-  SpTBXLib.zip
       |-  tb2k-2.2.2.zip

       |-  MultiInstaller.exe
       |-  Setup.ini 

You are ready to install the component packages, just run MultiInstaller, select the destination folder, and all the components will be unziped, compiled and installed on the Delphi IDE.

If you already have TB2K installed and only want to update SpTBXLib uncheck it on the MultiInstaller CheckListbox.

Getting Started

When the TSpTBXLib package is installed a new 'TSpTBXLib' tab is created on the Components Palette that holds all the package components.
The Toolbar Designer also suffers some changes, it has an additional toolbar that contains all the TSpTBXLib toolbar items.

All the TSpTBXLib components and items are marked with a small green '+' sign.

When creating applications with SpTBXLib package, you should try to use SpTBXLib items instead of Toolbar2000 items if you want to use this added features:

  • Unicode captions
  • Unicode hints
  • Custom item size
  • Anchored items
  • Right aligned items
  • Accel char handling
  • Custom painting events

Like in TBX, using TTBImageList is not recommended, use the standard TImageList instead.

For more information see the Components Reference and Items Reference sections.

FAQ

  1. How to install TB2K on Delphi 2009 and up
  2. How do I assign a unicode text to an item at designtime?
  3. How can I use anchored items?
  4. How can I right align an item?
  5. How can I anchor a control inside a toolbar?
  6. How can I custom paint a control or toolbar item?
  7. How can I rightalign the MDI buttons?
  8. How do I get rid of the button's focus rectangle?
  9. How to focus an edit/combobox/spin edit item?
  10. How to add scrollers to the TSpTBXTabControl/TSpTBXTabSet
  11. How to use Padding and Margins
  12. How to trap mouse events on the item area of compound components?
1. How to install TB2K on Delphi 2009 and up

You have 2 options to install TB2K:

  1. Use MultiInstaller to install TB2K and TB2K patch
  2. Manually apply the TB2K patch:
    1) Copy the contents of SpTBXLib\TB2K Patch folder to TB2K\Source folder.
    2) Run tb2kpatch.bat
2. How do I assign a unicode text to an item at designtime?

At designtime just set the Caption property in the Object Inspector.

3. How can I use anchored items?

The item should be placed on a TSpTBXToolbar with Stretched setted to True, and ShrinkMode setted to tbsmNone.
Just set the item's Anchored property to true, you can use the CustomWidth and CustomHeight properties to set the initial size value.

4. How can I right align an item?

The item should be placed on a TSpTBXToolbar with Stretched setted to True, and ShrinkMode setted to tbsmNone.
Just add a TSpTBXRightAlignSpacerItem above the item.

5. How can I anchor a control inside a toolbar?

The control should be placed on a TSpTBXToolbar with Stretched setted to True, and ShrinkMode setted to tbsmNone.
Drop a control on the toolbar and set the control's Align property to alClient or set the Anchors property to include akRight.

6. How can I custom paint a control or toolbar item?

You can custom paint toolbar items and controls using this events:

  • OnDrawItem/OnDrawBackground: to custom paint the item background
  • OnDrawCaption: to custom paint the item caption
  • OnDrawImage: to custom paint the item image icon
  • OnDrawHint: to custom paint the item hint

All these events have 2 important parameters: PaintStage and PaintDefault.
PaintStage indicates the current stage in the drawing process.
DefaultDraw indicates whether the control should continue with the default painting after the event handler exits. Set DefaultDraw to false to prevent the drawing of the control after the event handler exits. If DefaultDraw remains set to true, the control continues with the default painting process.

Example:

procedure TForm1.SpTBXItem1DrawItem(Sender: TObject; ACanvas: TCanvas;
  ARect: TRect; ItemInfo: TSpTBXMenuItemInfo;
  const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean);

begin
  if PaintStage = pstPrePaint then begin
    // Override the default painting, we are going to take care
    // of all the painting here
    PaintDefault := False;
    // Paint the item in red
    ACanvas.Brush.Color := clRed;
    ACanvas.Rectangle(ARect);
  end;
end; 

 

7. How can I rightalign the MDI buttons?

You have to set the toolbar's FullSize to true and ShrinkMode to tbsmWrap.

8. How do I get rid of the button's focus rectangle?

To disable the focus rectangle painting on button controls (TSpTBXButton, TSpTBXCheckBox, TSpTBXRadioButton) use the OnDrawCaption event, the focus rectangle is painted after the caption painting is done:

procedure TForm1.SpTBXButton1DrawCaption(Sender: TObject; 
  ACanvas: TCanvas; ClientAreaRect: TRect; var ACaption: WideString; 
  var CaptionRect: TRect; IsTextRotated: Boolean; 
  const PaintStage: TSpTBXPaintStage; var PaintDefault: Boolean);
begin
  if PaintStage = pstPostPaint then
    PaintDefault := False;
end;

 

9. How to focus an edit/combobox/spinedit item?

Use the SpFocusEditItem utility function located in the SpTBXEditors.pas unit. The first parameter is the editor item, the second parameter is the View where the item is located, normally a toolbar view:

procedure TForm1.Button1Click(Sender: TObject);
begin
  SpFocusEditItem(SpTBXComboBoxItem1, SpTBXToolbar1.View);

end;

 

10. How to add scrollers to the TSpTBXTabControl/TSpTBXTabSet

This is not done automatically by the control, you have to create the buttons yourself, take a look at the Overview demo.
I choose to leave it to the component user because there are many ways to handle this: scrollers, buttons, popups, chevron, different positions, etc.
You can also use the TabAutofit property to resize the tabs without the need to use scrollers, like Firefox.

11. How to use Padding and Margins

In Delphi, margins are used to specify the space around the control, and padding the offseting inside the control.
Padding, Margins and AlignWithMargins properties were introduced in BDS 4

12. How to trap mouse events on the item area of compound components?

The compound components such as the TSpTBXDockablePanel or the TSpTBXTabControl/TSpTBXTabSet have a Toolbar public property, access this property and use the mouse events of the internal toolbar:

procedure TForm1.FormShow(Sender: TObject);
begin
  SpTBXDockablePanel1.Toolbar.OnMouseDown := MyMouseDownEvent;
end;
  
procedure TForm1.MyMouseDownEvent(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
var
  IV: TTBItemViewer;
begin
  IV := SpTBXDockablePanel1.View.ViewerFromPoint(Point(X, Y));
  if Assigned(IV) then
    Caption := IV.Item.Name;
end;