Ich dachte ja, daß man über irgendeinen
ComponentState sagen kann, daß die Buttons designbar sind, aber ich fand nichts ... nja
Delphi-Quellcode:
unit ToolBar1;
interface
uses
SysUtils, Classes, Controls, ToolWin, ComCtrls;
type
TTestToolBar =
class(TToolBar)
private
{ Private-Deklarationen }
protected
{ Protected-Deklarationen }
procedure Loaded;
override;
public
{ Public-Deklarationen }
constructor Create(aOwner: TComponent);
override;
published
{ Published-Deklarationen }
end;
procedure Register;
implementation
procedure TTestToolBar.Loaded;
var
Button: TToolButton;
begin
inherited;
if ControlCount = 0
then
begin
Button := TToolButton.Create(Owner);
Button.Parent := Self;
Button.Caption := '
Speichern';
Button := TToolButton.Create(Owner);
Button.Parent := Self;
Button.Caption := '
Zurück';
Button := TToolButton.Create(Owner);
Button.Parent := Self;
Button.Caption := '
Vor';
Button := TToolbutton.Create(Owner);
Button.Parent := Self;
Button.Caption := '
Neu';
end;
end;
constructor TTestToolbar.Create(aOwner: TComponent);
begin
inherited;
Parent := aOwner
as TWinControl;
ShowCaptions := True;
if not (csLoading
in ComponentState)
then
Loaded;
end;
procedure Register;
begin
RegisterComponents('
Samples', [TTestToolBar]);
end;
end.