|
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.
Donations are accepted via either PayPal (preferred) or Kagi. Please click one of the following links to donate:
PayPal
Kagi

Thank you for your support.
Installation
Requirements:
- Jordan Russell's Toolbar 2000 (http://www.jrsoftware.org)
- Troy Wolbrink's TNT Unicode Controls (TntUnicodeControls.zip)
To install SpTBXLib manually:
- 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->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 to the created folder: SpTBXLib + TNT + TB2K
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
|- TntUnicodeControls.zip
|- tb2k-2.1.8.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
- How do I assign a unicode text to an item at runtime?
- How do I assign a unicode text to an item at designtime?
- How can I use anchored items?
- How can I right align an item?
- How can I anchor a control inside a toolbar?
- How can I custom paint a control or toolbar item?
- How can I rightalign the MDI buttons?
- How do I get rid of the button's focus rectangle?
- How to focus an edit/combobox/spin edit item?
- How to add scrollers to the TSpTBXTabControl/TSpTBXTabSet
- How to use Padding and Margins
- How to trap mouse events on the item area of compound components?
- How to migrate your project from using SpTBXLib 1.8 to 1.9
- How to migrate your project from using SpTBXLib 1.9 to 2.0
|
At runtime just set the Caption property to a WideString:
var
WS: WideString;
begin
SpTBXItem1.Caption := WS;
end;
|
At designtime just set the Caption property in the Object Inspector. |
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. |
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.

|
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. |
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;
|
You have to set the toolbar's FullSize to true and ShrinkMode to tbsmWrap. |
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;
|
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;
|
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. |
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 |
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;
|
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 |
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.
|
|