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:
- Delphi/C++Builder 2009 or newer
- Jordan Russell's Toolbar 2000 (http://www.jrsoftware.org)

To install SpTBXLib manually:
- Install TB2K and apply the TB2K patch or make the changes manually
http://www.silverpointdevelopment.com/sptbxlib/support.htm#15
- 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->Environment Options->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:
If you want to install SpTBXLib and all the required component packages:
1) Create a new folder for the installation.
2) Download all the component zips and the TB2K patch to the created folder: SpTBXLib + TB2K + TB2K Patch
3) Download the MultiInstaller
4) 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
       |-  TB2KPatch-2.2.2.zip	   
       |-  MultiInstaller.exe
       |-  Setup.ini 

You are ready to install the component packages, just run the 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 do I assign a unicode text to an item at runtime?
  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?
  13. How to migrate your project from using SpTBXLib 1.8 to 1.9
  14. How to migrate your project from using SpTBXLib 1.9 to 2.0
  15. How to install TB2K on Delphi 2009 and up
1. How do I assign a unicode text to an item at runtime?

At runtime just set the Caption property to a WideString:

var
  WS: WideString;
begin
  SpTBXItem1.Caption := WS;
end;

 

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;
13. How to migrate your project from using SpTBXLib 1.8 to 1.9

BACKUP YOUR FILES!!! I've made a lot of changes to decouple it from TBX so it will break your code.
- Removed TSpTBXToolbar.SnapDistance, the floating toolbar has ScreenSnap set to default
- Removed TSpTBXCustomItem.AlwaysSelectFirst, not used
- Changed the TSpTBXSpinEdit.ValueType to TSpTBXSpinType
- Changed the FontSettings property of the toolbar items, if you get this message "FontSettings.Bold, Bold doesn't exist" or something similar when you load your project just click Ignore and change the FontSettings property accordingly (e.g. set FontSettings.Style = [fsBold] ).
- Changed the parameters of the toolbar items OnDraw event. If you get this message "Item.OnDrawItem incorrect param list" just click NO and replace ItemInfo: TTBXItemInfo with ItemInfo: TSpTBXMenuItemInfo
- Renamed TSpTBXThemeType to TSpTBXSkinType
- Renamed TSpTBXThemeGroupItem to TSpTBXSkinGroupItem

14. How to migrate your project from using SpTBXLib 1.9 to 2.0

BACKUP YOUR FILES!!! 2.0 is decoupled from TBX so it will break your code.
The only changes from 1.9 to 2.0 are in the DockablePanels behavior.
- DockablePanels can only be docked to MultiDocks. When loading a project make sure no DockablePanels are docked to normal Docks.
- MultiDocks doesn't have lateral splitters, you can solve this by adding a TSplitter or a TSpTBXSplitter on the Form.

15. How to install TB2K on Delphi 2009 and up
You have 3 options to install TB2K
1) Use MultiInstaller to install TB2K and TB2K patch
2) Install TB2K and apply TB2K patch manually.
3) Install TB2K and make the following changes to the source files:

* In TB2DsgnItemEditor.pas change this line:
procedure UnregisterModuleItemClasses(AModule: {$IFDEF JR_D5} LongWord {$ELSE} Integer {$ENDIF});
To:
procedure UnregisterModuleItemClasses(AModule: {$IFDEF JR_D5} THandle {$ELSE} Integer {$ENDIF});
  
* In TB2ExtItems.pas, change the following TTBEditAction class methods implementation:
SetEditCaption, SetEditOptions, SetEditWidth, SetOnAcceptText, SetText.
Replace FClients.Count occurrences with ClientCount
Replace FClients occurences with Clients
  
* In TB2Item.pas comment the following lines:
//  {$IFNDEF CLR}
//  Exit; asm db 0,'Toolbar2000 (C) 1998-2008 Jordan Russell',0 end;
//  {$ENDIF}
  
* In TB2Reg.pas add Actions and System.UITypes units to the implementation section.
uses
  {$IFDEF CLR} WinUtils, {$ENDIF}
  ImgEdit, Actions, System.UITypes;
    
* In TB2Toolbar.pas add this at the implementation section:
{$IFDEF WIN64}
type
  TSmallPoint = TPoint;

function SmallPointToPoint(const P: TPoint): TPoint;
begin
  Result.X := P.X;
  Result.Y := P.Y;
end;

function PointToSmallPoint(const P: TPoint): TPoint;
begin
  Result.X := P.X;
  Result.Y := P.Y;
end;
{$ENDIF WIN64}



* For Delphi XE4 and up add System.Types unit to the interface section on the following files:
TB2Acc.pas
TB2Common.pas
TB2Dock.pas
TB2Item.pas (also add System.UITypes unit)