Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple error- could not create output file

Status
Not open for further replies.

librs

Programmer
Aug 23, 2004
2
US
hi gurus,
i am pretty new to delphi. i just started working on it and still i am a novice.

i am getting this problem and i dont know what to do?
[Fatal Error] StatusBarDPv2.pas(1717): Could not create output file 'c:\program files\borland\delphi7\DigitalPipelinev2\Bin\StatusBarDPv2.dcu'

the directory "DigitalPipelinev2\Bin\" is in c: root directory.
can i fix the problem with changing the environment options, if yes which one??
i would be glad if some one could also tell me what is the reason of the error .

thanks in advance
librs

 
there's a problem in the StatusBarDPv2 UNIT. Why don't you post the code from that unit, maybe someone can spot the error.



Leslie
 
Below is the code, i know it is too lengthy but i hope some one can dig in to it.
Code:
UNIT
    StatusBarDPv2;

interface

uses

    Windows, Graphics, Classes, CommCtrl, Comctrls, Menus, StdCtrls,
    Messages, Controls, SysUtils, Forms, Imglist, StdActns, dialogs, syncobjs;


const
  TIMER_ID = 200;
  HINT_TIMER_ID = 300;
  RICHEDIT_TIMER_ID = 400;

type


  TDPv2StatusPanels = class;
  TDPv2ProgressBarProps = class;
  TDPv2AnimateProps = class;
  TDPv2CustomStatusBar = class;
  TDPv2StatusPanel = class;
  TDPv2CustomStatusBarClass = class of TDPv2CustomStatusBar;
  TDPv2StatusPanelStyle = ( psText, psOverWrite, psCapsLock, psNumLock, psDateTime, psDate, psTime,
                         psRichEditStatus, psUserName, psComputerName, psScrollLock,
                         psLink, psProgressBar,psOwnerDraw,psAnimate);

  TDPv2StatusPanelBevel = (pbNone, pbLowered, pbRaised);

  TDPv2PanelTextChangedEvent = procedure(Sender: TObject; const Text: string) of object;
  TDPv2DrawTextEvent = procedure(Panel: TDPv2StatusPanel; var Text: string; var Enabled:Boolean) of object;
  TDPv2DrawPanelEvent = procedure(StatusBar: TDPv2CustomStatusBar; Panel: TDPv2StatusPanel; const Rect: TRect) of object;


  TDPv2ProgressBarProps = Class(TPersistent)
  private
    FSmooth: Boolean;
    FPosition: Integer;
    FMax: Integer;
    FMin: Integer;
    FStep: Integer;
    FOnChange: TNotifyEvent;
    procedure SetMax(const Value: Integer);
    procedure SetMin(const Value: Integer);
    procedure SetPosition(const Value: Integer);
    procedure SetSmooth(const Value: Boolean);
    procedure SetStep(const Value: Integer);
    procedure SetOnChange(const Value: TNotifyEvent);
  protected
//      procedure Changed; override;
  public
    constructor Create;
    destructor  Destroy; override;
    procedure   Reset(Sender : TObject);
    procedure   Assign(Source: TPersistent); override;
    property    OnChange:TNotifyEvent read FOnChange write SetOnChange;
  published
    property Max : Integer read FMax write SetMax;
    property Min : Integer read FMin write SetMin;
    Property Position : Integer read FPosition write SetPosition;
    Property Smooth : Boolean read FSmooth write SetSmooth;
    Property Step : Integer read FStep write SetStep;
  end;

  TDPv2AnimateProps = Class(TPersistent)
  private
    FAviFile : String;
    FActive: Boolean;
    FOnChange: TNotifyEvent;
    procedure SetAviFile(const Value: String);
    procedure SetActive(const Value: Boolean);
    procedure SetOnChange(const Value: TNotifyEvent);
  protected
//      procedure Changed; override;
  public
    constructor Create;
    destructor  Destroy; override;
    procedure   Reset(Sender : TObject);
    procedure   Assign(Source: TPersistent); override;
    property    OnChange:TNotifyEvent read FOnChange write SetOnChange;
  published
    property AviFile : String read FAviFile write SetAviFile;
    Property Active  : Boolean read FActive write SetActive;
  end;

  TDPv2StatusPanel = class(TCollectionItem)
  private
    FWidth: Integer;
    FCol: Integer;
    FRow: Integer;
    FColor: TColor;
    FCollection:TCollection;
    FComponent: TComponent;
    FEnabled: Boolean;
    FFont: TFont;
    FHint: String;
    FImageIndex: Integer;
    FIndent: Integer;
    FMargin: Integer;
    FName: string;
    FPopupMenu: TPopupMenu;
    FStyle: TDPv2StatusPanelStyle;
    FText: string;
    FCurDateTime: TDateTime;
    FRect: TRect;
    FDrawTextEnabled: Boolean;
    FPaintWidth: Integer;
    FCanvas: TCanvas;
    FOnTextChanged: TDPv2PanelTextChangedEvent;
    FBevel: TDPv2StatusPanelBevel;
    FOnMouseDown: TMouseEvent;
    FOnMouseUp: TMouseEvent;
    FOnMouseMove: TMouseMoveEvent;
    FOnClick: TNotifyEvent;
    FOnSetName: TNotifyEvent;
    FOnDblClick: TNotifyEvent;
    FUpdateNeeded: Boolean;
    FParentBiDiMode: Boolean;
    FBiDiMode: TBiDiMode;
    FProgressBarProps: TDPv2ProgressBarProps;
    FAnimateProps: TDPv2AnimateProps;
    FCriticalSection : TCriticalSection;
    // Property Access Methods
    function    GetControl: TControl;
    procedure   SetColor(Value: TColor);
    procedure   SetEnabled(Value: Boolean);
    procedure   SetFont(Value:TFont);
    procedure   SetHint(Value:String);
    procedure   SetImageIndex(Value: Integer);
    procedure   SetIndent(Value:Integer);
    procedure   SetMargin(Value: Integer);
    procedure   SetName(const Value: string);
    procedure   SetStyle(Value: TDPv2StatusPanelStyle);
    procedure   SetText(const Value: string);
    procedure   SetWidth(Value: Integer);
    procedure   SetBevel(const Value: TDPv2StatusPanelBevel);
    procedure   SetComponent(const Value: TComponent);
    procedure   SetParentBiDiMode(const Value: Boolean);
    procedure   SetBiDiMode(const Value: TBiDiMode);
    procedure   SetProgressBarProps(const Value: TDPv2ProgressBarProps);
    procedure   SetAnimateProps(const Value: TDPv2AnimateProps);
    procedure   DestroyProgressBar(Sender : TObject);
    procedure   DestroyAnimate(Sender : TObject);


  protected

    function    GenerateName: string; virtual;
    function    GetDisplayName: string; override;
    function    GetStatusBar: TDPv2CustomStatusBar; virtual;
    function    StoreWidth: Boolean; virtual;
    procedure   FontChanged(Sender: TObject); virtual;
    procedure   CreateProgressBar(Sender: TObject);
    procedure   CreateAnimate(Sender : TObject);
    procedure   Notification(AComponent: TComponent; Operation: TOperation); virtual;
    procedure   AdjustBounds; virtual;
    procedure   ProgressBarPropsChange(Sender : TObject);
    procedure   AnimatePropsChange(Sender : TObject);
    // Draw methods
    function    DoDrawDateTime: Boolean; virtual;
    procedure   Draw(ACanvas: TCanvas; ARect: TRect); virtual;
    procedure   DrawControl; virtual;
    procedure   DrawGlyph; virtual;
    procedure   DrawKeyboardState; virtual;
    procedure   DrawHint; virtual;
    procedure   DrawUserName; virtual;
    procedure   DrawComputerName; virtual;
    procedure   DrawRichEditStatus; virtual;
    procedure   DrawText(AText: string; ARect: TRect; AEnabled:Boolean); virtual;
    procedure   AssignTo(Dest: TPersistent); override;

    procedure   Click; dynamic;
    procedure   DblClick; dynamic;
    procedure   MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); dynamic;
    procedure   MouseMove(Shift: TShiftState; X, Y: Integer); dynamic;
    procedure   MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); dynamic;
    procedure   PanelTextChanged(Const Text:String); dynamic;
    property    Canvas: TCanvas read FCanvas;
    property    DrawTextEnabled: Boolean read FDrawTextEnabled write FDrawTextEnabled;

  PUBLIC

    constructor Create(Collection: TCollection); override;
    destructor  Destroy; override;
    procedure   ParentBiDiModeChanged;
    function    ClientToScreen(p: TPoint): TPoint; virtual;
    function    GetRect: TRect; virtual;
    procedure   Invalidate; virtual;

    property Col: Integer read FCol;
    property Control: TControl read GetControl;
    property PaintWidth: Integer read FPaintWidth write FPaintWidth;
    property StatusBar: TDPv2CustomStatusBar read GetStatusBar;
    property OnSetName: TNotifyEvent read FOnSetName write FOnSetName;
    property Component: TComponent read FComponent write SetComponent;
    property PopupMenu: TPopupMenu read FPopupMenu write FPopupMenu;
  PUBLISHED

    property Bevel: TDPv2StatusPanelBevel read FBevel write SetBevel default pbLowered;
    property Color: TColor read FColor write SetColor default clBtnFace;
    Property BiDiMode: TBiDiMode read FBiDiMode write SetBiDiMode;
    property ParentBiDiMode: Boolean read FParentBiDiMode write SetParentBiDiMode;
    property Enabled: Boolean read FEnabled write SetEnabled default True;
    property Font: TFont read FFont write SetFont;
    property Hint : string read FHint write SetHint;
    property ImageIndex: Integer read FImageIndex write SetImageIndex default 0;
    property Indent : Integer read FIndent write SetIndent default 0;
    property Margin: Integer read FMargin write SetMargin default 0;
    property Name: string read FName write SetName;
    property Style: TDPv2StatusPanelStyle read FStyle write SetStyle default psText;
    property Text : string read FText write SetText;
    property ProgressBarProps:TDPv2ProgressBarProps read FProgressBarProps write SetProgressBarProps;
    property AnamateProps:TDPv2AnimateProps read FAnimateProps write SetAnimateProps;
    property Width: Integer read FWidth write SetWidth stored StoreWidth;
    property OnClick: TNotifyEvent read FOnClick write FOnClick;
    property OnDblClick: TNotifyEvent read FOnDblClick write FOnDblClick;
//    property OnDrawText: TfcDrawTextEvent read FOnDrawText write FOnDrawText;
    property OnMouseDown: TMouseEvent read FOnMouseDown write FOnMouseDown;
    property OnMouseMove: TMouseMoveEvent read FOnMouseMove write FOnMouseMove;
    property OnMouseUp: TMouseEvent read FOnMouseUp write FOnMouseUp;
    property OnTextChanged: TDPv2PanelTextChangedEvent read FOnTextChanged write FOnTextChanged;
  end;



   TDPv2StatusPanels = class (TCollection)
   private
      FStatusBar : TDPv2CustomStatusBar;
      function GetItem (Index : Integer) : TDPv2StatusPanel;
      procedure SetItem (Index : Integer; Value : TDPv2StatusPanel);
   protected
      function GetOwner : TPersistent; override;
      procedure Update (Item : TCollectionItem); override;
   public
      constructor Create(StatusBar: TDPv2CustomStatusBar);
      function Add : TDPv2StatusPanel;
      function PanelByName(AName: string): TDPv2StatusPanel;
      property Items [Index : Integer] : TDPv2StatusPanel read GetItem write SetItem; default;
   end;


   TDPv2CustomStatusBar = class (TWinControl)
   private
       FImageList: TCustomImageList;       // Published
       FPanels: TDPv2StatusPanels;
       FCanvas: TCanvas;
       FSimplePanel: Boolean;
       FSimpleText: string;
       FSizeGrip: Boolean;
       FSizing: Boolean;
       FUseSystemFont: Boolean;
       FAutoHint: Boolean;
       FOnDrawPanel: TDPv2DrawPanelEvent;
       FOnHint: TNotifyEvent;

       procedure CMBiDiModeChanged(var Message: TMessage); message CM_BIDIMODECHANGED;
       procedure CMColorChanged(var Message: TMessage); message CM_COLORCHANGED;
       procedure CMParentFontChanged(var Message: TMessage); message CM_PARENTFONTCHANGED;
       procedure CMSysColorChange(var Message: TMessage); message CM_SYSCOLORCHANGE;
       procedure CMWinIniChange(var Message: TMessage); message CM_WININICHANGE;
       procedure CMSysFontChanged(var Message: TMessage); message CM_SYSFONTCHANGED;
       procedure CNDrawItem(var Message: TWMDrawItem); message CN_DRAWITEM;
       procedure WMGetTextLength(var Message: TWMGetTextLength); message WM_GETTEXTLENGTH;
       procedure WMSize(var Message: TWMSize); message WM_SIZE;

       procedure UpdatePanel(Index: Integer; Repaint: Boolean);Virtual;
       procedure UpdatePanels;Virtual;
       procedure SetSizeGrip(const Value: Boolean);
       function  GetSizeGrip: Boolean;
       procedure SetPanels(const Value: TDPv2StatusPanels);
       procedure SetImageList(const Value: TCustomImageList);
       procedure SetUseSystemFont(const Value: Boolean);
       procedure SetSimplePanel(const Value: Boolean);       

   PROTECTED

      procedure ChangeScale(M : Integer; D : Integer); override;
      procedure CreateParams (var Params : TCreateParams); override;
      procedure CreateWnd; override;
      function  DoHint : Boolean; virtual;
      procedure DrawPanel(Panel : TDPv2StatusPanel; Rect : TRect); dynamic;
      procedure SyncToSystemFont;
      procedure DestroyWnd; override;
      procedure DoRightToLeftAlignment(var Str: string; AAlignment: TAlignment; ARTLAlignment: Boolean);

   PUBLIC
       procedure   ComponentExclusive(Value: TComponent; Panel: TDPv2StatusPanel; ThisStatusBarOnly: Boolean);
       constructor Create(AOwner: TComponent); override;
       destructor  Destroy; override;
       function    ExecuteAction(Action: TBasicAction): Boolean; override;
       procedure   FlipChildren(AllLevels: Boolean); override;
       property    Canvas: TCanvas read FCanvas;
       procedure   Invalidate; override;
       property    SimplePanel : Boolean read FSimplePanel write SetSimplePanel;
   PUBLISHED

       property Action;
       property Anchors;
       property Constraints;
       property AutoHint: Boolean read FAutoHint write FAutoHint default False;
       property UseSystemFont: Boolean read FUseSystemFont write SetUseSystemFont;
       property OnDrawPanel: TDPv2DrawPanelEvent read FOnDrawPanel write FOnDrawPanel;
       property Align default alBottom;
       property DragCursor;
       property DragMode;
       property Enabled;
       property Font;
       property SizeGrip: Boolean read GetSizeGrip write SetSizeGrip;
       property ImageList : TCustomImageList read FImageList write SetImageList;
       property Panels: TDPv2StatusPanels read FPanels write SetPanels;
       property ParentFont;
       property ParentShowHint;
       property PopupMenu;
       property ShowHint;
//    property StatusBarText; Use the regular bar if you need this.
       property Visible;
       property OnClick;
       property OnDblClick;
       property OnDragDrop;
       property OnDragOver;
       property OnEndDrag;
       property OnMouseDown;
       property OnMouseMove;
       property OnMouseUp;
//    property OnDrawKeyboardState;
       property OnResize;
       property OnStartDrag;
   end;



  TStatusBarDPv2 = class(TDPv2CustomStatusBar)
  end;

implementation
var StatusBars: TList;
{ TDPv2StatusPanel }

function _RectWidth(Rect: TRect): Integer;
begin
  result := Rect.Right - Rect.Left;
end;

function _GetComputerName : string;
var ComputerName:String;
    isize:Cardinal;
begin
  isize := 25;
  SetLength(ComputerName,isize);
  if GetComputerName(PChar(ComputerName),isize) then
  begin
     SetLength(ComputerName,isize);
     result := ComputerName;
  end
  else result := '';
end;

function _Min(Int1, Int2: Integer): Integer;
begin
  if Int1 < Int2 then result := Int1 else result := Int2;
end;

function _Max(Int1, Int2: Integer): Integer;
begin
  if Int1 > Int2 then result := Int1 else result := Int2;
end;

function _RectHeight(Rect: TRect): Integer;
begin
  result := Rect.Bottom - Rect.Top;
end;

procedure _ImageListDraw(ImageList: TCustomImageList; Index: Integer; Canvas: TCanvas;
  X, Y: Integer; Style: Cardinal; Enabled: Boolean);
const
  ROP_DSPDxax = $00E20746;
var
  R: TRect;
  DestDC, SrcDC: HDC;
  function GetRGBColor(Value: TColor): DWORD;
  begin
    Result := ColorToRGB(Value);
    case Result of
      clNone: Result := CLR_NONE;
      clDefault: Result := CLR_DEFAULT;
    end;
  end;
var AMonoBitmap: TBitmap;
begin
  with ImageList do
  begin
    if HandleAllocated then begin
        if Enabled then
            ImageList_DrawEx(Handle, Index, Canvas.Handle, X, Y, 0, 0,
            GetRGBColor(TImageList(ImageList).BkColor), GetRGBColor(TImageList(ImageList).BlendColor), Style)
      else begin
          AMonoBitmap := TBitmap.Create;
          with AMonoBitmap do begin
              Monochrome := True;
              Width := TImageList(ImageList).Width;
              Height := TImageList(ImageList).Height;
          end;

        ImageList_DrawEx(Handle, Index, AMonoBitmap.Canvas.Handle, 0,0,0,0, 0,0,ILD_MASK);
        R := Rect(X, Y, X+TImageList(ImageList).Width, Y+TImageList(ImageList).Height);
        SrcDC := AMonoBitmap.Canvas.Handle;
        Canvas.Brush.Color := clBtnHighlight;
        DestDC := Canvas.Handle;
        Windows.SetTextColor(DestDC, clWhite);
        Windows.SetBkColor(DestDC, clBlack);
        BitBlt(DestDC, X+1, Y+1, TImageList(ImageList).Width, TImageList(ImageList).Height, SrcDC, 0, 0, ROP_DSPDxax);
        Canvas.Brush.Color := clBtnShadow;
        DestDC := Canvas.Handle;
        Windows.SetTextColor(DestDC, clWhite);
        Windows.SetBkColor(DestDC, clBlack);
        BitBlt(DestDC, X, Y, TImageList(ImageList).Width, TImageList(ImageList).Height, SrcDC, 0, 0, ROP_DSPDxax);
        AMonoBitmap.Free;
      end;
    end;
  end;
end;


procedure TDPv2StatusPanel.AdjustBounds;
begin

end;

procedure TDPv2StatusPanel.AssignTo(Dest: TPersistent);
begin
  if Dest is TDPv2StatusPanel then
    with TDPv2StatusPanel(Dest) do
    begin
      FBevel := self.Bevel;
      FColor := self.Color;
      FComponent := self.Component;
      FEnabled := self.Enabled;
      FFont.Assign(self.Font);
      FHint := self.Hint;
      FImageIndex := self.ImageIndex;
      FIndent := self.Indent;
      FMargin := self.Margin;
      FPopupMenu := self.PopupMenu;
      FStyle := self.Style;
      FText := self.Text;
      FWidth := self.Width;

      FOnClick := self.OnClick;
      FOnDblClick := self.OnDblClick;
//      FOnDrawText := self.OnDrawText;
      FOnMouseDown := self.OnMouseDown;
      FOnMouseMove := self.OnMouseMove;
      FOnMouseUp := self.OnMouseUp;
      FOnTextChanged := self.OnTextChanged;
    end
  else inherited AssignTo(Dest);
end;

procedure TDPv2StatusPanel.Click;
begin

end;

function TDPv2StatusPanel.ClientToScreen(p: TPoint): TPoint;
    var r: TRect;
begin
  r := GetRect;
  result := Point(p.x + r.Left, p.y + r.Top);
  result := StatusBar.ClientToScreen(result);
end;

procedure TDPv2StatusPanel.ProgressBarPropsChange(Sender : TObject);
BEGIN
  If Control<>nil then begin
     TProgressBar(Control).Max:=FProgressBarProps.Max;
     TProgressBar(Control).Min:=FProgressBarProps.Min;
     TProgressBar(Control).Position:=FProgressBarProps.Position;
     TProgressBar(Control).Step:=FProgressBarProps.Step;
     TProgressBar(Control).Smooth:=FProgressBarProps.Smooth;
  end;
END;

procedure TDPv2StatusPanel.AnimatePropsChange(Sender : TObject);
BEGIN
  If Control<>nil then begin
     TAnimate(Control).FileName :=FAnimateProps.AviFile;
     TAnimate(Control).Active   :=FAnimateProps.Active;
  end;
END;

constructor TDPv2StatusPanel.Create(Collection: TCollection);
begin
  Collection.BeginUpdate;
  inherited Create(Collection);
  FCollection:=Collection;
  FProgressBarProps:=TDPv2ProgressBarProps.Create;
  FProgressBarProps.Smooth:=true;
  FProgressBarProps.OnChange:=ProgressBarPropsChange;
  FAnimateProps:=TDPv2AnimateProps.Create;
  FAnimateProps.AviFile := '';
  FAnimateProps.Active := False;
  FWidth := 50;
  FPaintWidth := FWidth;
  FBevel := pbLowered;
  FEnabled := True;
  FColor := clBtnFace;
  FCanvas := TCanvas.Create;
  FFont := TFont.Create;
  FFont.OnChange := FontChanged;
  FFont.Assign(StatusBar.Font);
  FIndent := 0;
  FName := GenerateName;
  FImageIndex:=-1;
  FCriticalSection:=TCriticalSection.Create;
//  OnSetName := SetButtonName;
  Collection.EndUpdate;

end;

procedure TDPv2StatusPanel.DblClick;
begin

end;

destructor TDPv2StatusPanel.Destroy;
begin
  If Assigned(FFont) then
     FFont.Free;
  If Assigned(FComponent) then
     FComponent.Free;
     FComponent:=nil;
  If Assigned(FProgressBarProps) then
     FProgressBarProps.Free;
     FProgressBarProps:=nil;
  If Assigned(FAnimateProps) then
     FAnimateProps.Free;
     FAnimateProps:=nil;
  If Assigned(FCriticalSection) then
     FCriticalSection.Free;
     FCriticalSection:=nil;



  inherited destroy;

end;

function TDPv2StatusPanel.DoDrawDateTime: Boolean;
    var AText: string;
begin
   AText := '';
   case FStyle of
    psDate: begin
              AText := DateToStr(Date);
              FCurDateTime := Trunc(Date);
            end;
    psTime: begin
              DateTimeToString(AText,ShortTimeFormat,Now);
              FCurDateTime := Frac(Time);
            end;
    psDateTime:
            begin
              DateTimeToString(AText,ShortDateFormat+' ' + ShortTimeFormat,Now);
              FCurDateTime := Now;
            end;
  end;
  result := False;

  Text:=AText;
  result := True;
  DrawText(FText, FRect,Enabled);
  PanelTextChanged(AText);

end;

procedure TDPv2StatusPanel.Draw(ACanvas: TCanvas; ARect: TRect);
var RealCanvas: TCanvas;
    RealRect: TRect;
begin
    RealCanvas := FCanvas;
    RealRect := FRect;
    FCanvas := ACanvas;
    FRect := ARect;
    FCanvas.Brush.Color := FColor;
    FCanvas.FillRect(FRect);
    DrawGlyph;
    FCanvas := RealCanvas;
    FRect := RealRect;
end;

procedure TDPv2StatusPanel.DrawComputerName;
begin
  DrawText(_GetComputerName, FRect,Enabled);
end;

procedure TDPv2StatusPanel.CreateProgressBar(Sender : TObject);
begin
  If (Control = nil) then begin
      Component:=TProgressBar.Create(NIL);
      Control.Parent := StatusBar;
      FUpdateNeeded:=TRUE;
  end;
end;

procedure TDPv2StatusPanel.CreateAnimate(Sender : TObject);
begin
  If (Control = nil) then begin
      Component:=TAnimate.Create(Statusbar.Owner);
      TAnimate(Control).Parent := StatusBar;
      TAnimate(Control).Autosize := False;
      TAnimate(Control).BorderWidth := 0;
      TAnimate(Control).Top := Statusbar.Top+1;
      TAnimate(Control).Left := Statusbar.Left+1;
//      TAnimate(Control).Height := 20;
//      TAnimate(Control).Width := 30;
//      TAnimate(Control).Center := True;
//      TAnimate(Control).CommonAvi := aviCopyFile;
      TAnimate(Control).ResName := 'TRANSAVI';
      TAnimate(Control).Active := True;
      FUpdateNeeded:=TRUE;
  end;
end;

procedure TDPv2StatusPanel.DrawControl;
var r: TRect;
  procedure InvalidateChildren(Control: TWinControl);
  var i: integer;
  begin
    Control.Invalidate;
    for i := 0 to Control.ControlCount - 1 do
       if Control.Controls[i] is TWinControl then
          InvalidateChildren(Control.Controls[i] as TWinControl);
  end;
begin
  if ((Statusbar <> nil) and (csLoading in StatusBar.ComponentState)) then
    Exit;

  If Control = nil then
     exit;
//  DrawText(Text, FRect, Enabled);

  r := FRect;
//  if Text <> '' then
//  begin
//    if TextOptions.Alignment = taLeftJustify then r.Left := TextOptions.TextRect.Right + 2
//    else if TextOptions.Alignment = taRightJustify then r.Right := TextOptions.TextRect.Left - 2;
//  end;

  InflateRect(r,-Margin,-Margin);
  if (_RectWidth(r) > 0) and (_RectHeight(r) > 0) then
    Control.BoundsRect := r;
  if (Control is TWinControl) then InvalidateChildren(Control as TWinControl);

end;

procedure TDPv2StatusPanel.DrawGlyph;
var aLeft,aTop:Integer;
begin
  if (StatusBar.ImageList <> nil) and (FStyle<>psProgressBar) and
  (FStyle<>psAnimate) AND
  (FImageIndex >= 0) and (FImageIndex < StatusBar.ImageList.Count) then
  begin
    ALeft := FRect.Left+FMargin;
    ATop := FRect.Top+(((FRect.Bottom-FRect.Top)-TImageList(StatusBar.ImageList).height)div 2);
    _ImageListDraw(StatusBar.ImageList,FImageIndex,Canvas,ALeft,ATop,ILD_NORMAL,True);
    FRect := Rect(FRect.Left+TImageList(StatusBar.ImageList).Width+5,FRect.Top,FRect.Right,FRect.Bottom);
  end;

  case FStyle of
    psText:DrawText(FText,FRect,Enabled);
    psDate, psTime, psDateTime:DoDrawDateTime;
    psProgressBar : DrawControl;
    psAnimate : DrawControl;
    psOverWrite, psCapsLock, psNumLock, psScrollLock: DrawKeyboardState;
    psRichEditStatus: DrawRichEditStatus;
//    psHint: DrawHint;
    psUserName: DrawUserName;
    psComputerName: DrawComputerName;
  end;
end;

procedure TDPv2StatusPanel.DrawHint;
begin
    DrawText(Application.Hint, FRect, Enabled);
end;

procedure TDPv2StatusPanel.DrawKeyboardState;
var
  Key: Integer;
  AText: string;
begin
{  Key := 0;
  AText := FText;
  FText := '';

  case FStyle of
    psOverwrite:  begin
                    Key := VK_INSERT;
                    AText := StatusBar.StatusBarText.Overwrite;
                  end;
    psCapsLock:   begin
                    Key := VK_CAPITAL;
                    AText := StatusBar.StatusBarText.CapsLock;
                  end;
    psNumLock:    begin
                    Key := VK_NUMLOCK;
                    AText := StatusBar.StatusBarText.NumLock;
                  end;
    psScrollLock: begin
                    Key := VK_SCROLL;
                    AText := StatusBar.StatusBarText.ScrollLock;
                  end;
  end;

  if Assigned(StatusBar.FOnDrawKeyboardState) then
     StatusBar.FOnDrawKeyboardState(StatusBar, self, System.Odd(GetKeyState(Key)), FRect, AText);

  DrawText(AText,FRect, System.Odd(GetKeyState(Key)));
}
end;

procedure TDPv2StatusPanel.DrawRichEditStatus;
var AText: string;
begin
  AText := 'Ln: ' + IntToStr(FRow+1) + ', Col: ' + IntToStr(FCol+1);
  DrawText(AText,FRect,Enabled);
end;


procedure TDPv2StatusPanel.DrawText(AText: string; ARect: TRect;
  AEnabled: Boolean);
  const
  Alignments: array[TAlignment] of Integer = (DT_LEFT, DT_RIGHT, DT_CENTER);
var i: Integer;
    s: string;
    Angle: Extended;
    CurLineHeight: Integer;
begin
  If (csLoading in StatusBar.ComponentState) then exit;
  InflateRect(ARect, -2, 0);
  inc(ARect.Left, Indent);
  if FFont = nil then
      FCanvas.Font.Assign(StatusBar.Font)
  else FCanvas.Font.Assign(Font);
  try
    if AEnabled then FDrawTextEnabled := True
    else FDrawTextEnabled := False;

    FCanvas.Brush.Style := bsClear;
  finally

  end;
//  if AText <> FText then begin
//    DrawTextEx(FCanvas.Handle, PChar(''), Length(''), ARect, DT_END_ELLIPSIS, nil);
    DrawTextEx(FCanvas.Handle, PChar(AText), Length(AText), ARect, DT_END_ELLIPSIS, nil);
    FText:=AText;
//    PanelTextChanged(AText);
//  end;
end;

procedure TDPv2StatusPanel.DrawUserName;
var nsize:Cardinal;
    UserName:String;
begin
  nsize := 25;
  SetLength(UserName,nsize);
  if GetUserName(PChar(UserName), nsize) then
  begin
     SetLength(UserName,nsize-1);
     DrawText(UserName,FRect,Enabled);
  end;
end;

procedure TDPv2StatusPanel.FontChanged(Sender: TObject);
begin
    inherited
    Changed(False);
end;

function TDPv2StatusPanel.GenerateName: string;
var i:integer;
begin
  i := 0;
  repeat
    result := 'Panel' + IntToStr(i);
    inc(i);
  until StatusBar.Panels.PanelByName(result) = nil;

end;

function TDPv2StatusPanel.GetControl: TControl;
begin
  result := nil;
  if Component is TControl then
      result := Component as TControl;
end;

function TDPv2StatusPanel.GetDisplayName: string;
begin
  Result := Name;
  if Result = '' then Result := inherited GetDisplayName;
end;

function TDPv2StatusPanel.GetRect: TRect;
begin
  SendMessage(StatusBar.Handle, SB_GETRECT, Index, LPARAM(@result));
end;


function TDPv2StatusPanel.GetStatusBar: TDPv2CustomStatusBar;
begin
  result := TDPv2StatusPanels(Collection).FStatusBar;

end;

procedure TDPv2StatusPanel.Invalidate;
var r: TRect;
    DrawBitmap: TBitmap;
    ACanvas: TCanvas;
    TempWidth: Integer;
begin

  if csLoading in StatusBar.ComponentState then Exit;
  r := GetRect;
  if not StatusBar.FSizing then if Style in [psDate, psDateTime, psTime] then
    case FStyle of
      psDate: if Trunc(Date) = FCurDateTime then Exit;
      psTime: if Frac(Date) = FCurDateTime then Exit;
      psDateTime: if Now = FCurDateTime then Exit;
    end;

  FRect:=r;
  DrawBitmap := TBitmap.Create;
  ACanvas := TCanvas.Create;
  try
    if StatusBar.SizeGrip and (StatusBar.Panels[StatusBar.Panels.Count-1]=self) then
       TempWidth := (FRect.Right - FRect.Left)  - _Min(23,GetSystemMetrics(SM_CXVSCROLL)+1)
    else TempWidth := (FRect.Right - FRect.Left);

    if TempWidth > 0 then DrawBitmap.Width := TempWidth else Exit;

    DrawBitmap.Height := _RectHeight(FRect);

    Draw(DrawBitmap.Canvas, Rect(0, 0, DrawBitmap.Width, DrawBitmap.Height));
    ACanvas.Handle := GetDC(StatusBar.Handle);
    ACanvas.Draw(FRect.Left, FRect.Top, DrawBitmap);
    ReleaseDC(StatusBar.Handle, ACanvas.Handle);
  finally
    ACanvas.Free;
    DrawBitmap.Free;
  end;
end;

procedure TDPv2StatusPanel.MouseDown(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
begin
inherited;
end;

procedure TDPv2StatusPanel.MouseMove(Shift: TShiftState; X, Y: Integer);
begin

end;

procedure TDPv2StatusPanel.MouseUp(Button: TMouseButton; Shift: TShiftState;
  X, Y: Integer);
begin

end;

procedure TDPv2StatusPanel.Notification(AComponent: TComponent;
  Operation: TOperation);
begin
  if (Operation = opRemove) and (AComponent = FComponent) then
    Component := nil;
  if (Operation = opRemove) and (AComponent = FPopupMenu) then
    PopupMenu := nil;
end;

procedure TDPv2StatusPanel.PanelTextChanged(const Text: String);
begin
  if Assigned(FOnTextChanged) then FOnTextChanged(Self, Text);
end;

procedure TDPv2StatusPanel.ParentBiDiModeChanged;
begin
  if FParentBiDiMode then
  begin
    if GetOwner <> nil then
    begin
      BiDiMode := TDPv2StatusPanels(GetOwner).FStatusBar.BiDiMode;
      FParentBiDiMode := True;
    end;
  end;
end;

procedure TDPv2StatusPanel.SetBevel(const Value: TDPv2StatusPanelBevel);
begin
  FBevel := Value;
end;

procedure TDPv2StatusPanel.SetBiDiMode(const Value: TBiDiMode);
begin
  if Value <> FBiDiMode then
  begin
    FBiDiMode := Value;
    FParentBiDiMode := False;
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetColor(Value: TColor);
begin
  if FColor <> Value then
  begin
    FColor := Value;
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetComponent(const Value: TComponent);
begin
    if (Value = nil) and (Component = nil) then Exit;

    if (Value = StatusBar) then
        raise EInvalidOperation.Create('Control cannot equal parent StatusBar');

    if (Control <> nil) and not (csDestroying in Control.ComponentState) then
        Control.Parent := GetParentForm(StatusBar);

    FComponent := Value;

    if FComponent = nil then FStyle := psText
        else if (FComponent is TCustomRichEdit) then begin
                 Style := psRichEditStatus;
             end else if (FComponent is TControl) then begin
                              if (Control <> Value) and (StatusBar <> nil) then
                                  Control.Parent := StatusBar.Parent;
//    Style := psProgressBar;
  end;

  Changed(False);
end;

procedure TDPv2StatusPanel.SetEnabled(Value: Boolean);
begin
  if FEnabled <> Value then
  begin
    FEnabled := Value;
    if (Control <> nil) then
      Control.Enabled := Value;
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetFont(Value: TFont);
begin
  if FFont <> Value then
  begin
    FFont.Assign(Value);
    if (Control <> nil) then
       TEdit(Control).Font.Assign(Value);
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetHint(Value: String);
begin
  if FHint <> Value then
  begin
    FHint := Value;
    if ((FStyle = psProgressBar) OR (FStyle = psAnimate))
    and (Control <> nil) then
       Control.Hint := Value;
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetImageIndex(Value: Integer);
begin
  if FImageIndex <> Value then begin
      FImageIndex := Value;
      Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetIndent(Value: Integer);
begin
  if FIndent <> Value then begin
      FIndent := Value;
      Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetMargin(Value: Integer);
begin
  if FMargin <> Value then
  begin
    FMargin := Value;
    Changed(False);
  end;
end;

procedure TDPv2StatusPanel.SetName(const Value: string);
begin
  if FName <> Value then
  begin
    if (StatusBar.Panels.PanelByName(Value) <> nil) then
      raise EInvalidOperation.CreateFmt('A panel named %s already exists.', [Value]);
    FName := Value;
    Changed(False);
    if Assigned(FOnSetName) then FOnSetName(self);
  end;
end;

procedure TDPv2StatusPanel.SetParentBiDiMode(const Value: Boolean);
begin
  FParentBiDiMode := Value;
end;

procedure TDPv2StatusPanel.SetStyle(Value: TDPv2StatusPanelStyle);
var i:integer;
    TimerNeeded:Boolean;
begin
try
  FCriticalSection.Enter;
  if FStyle <> Value then begin
    if (StatusBar.HandleAllocated) and (FStyle = psRichEditStatus) then
    begin
       TimerNeeded := False;
       for i:= 0 to StatusBar.Panels.Count-1 do
          if (StatusBar.Panels[i]<>Self) and
             (StatusBar.Panels[i].Style = psRichEditStatus) then
                TimerNeeded := True;
       if not TimerNeeded then KillTimer(StatusBar.Handle, RICHEDIT_TIMER_ID);
    end;

{    if (StatusBar.HandleAllocated) and (FStyle = psHint) then
    begin
       TimerNeeded := False;
       for i:= 0 to StatusBar.Panels.Count-1 do
          if (StatusBar.Panels[i]<>Self) and
             (StatusBar.Panels[i].Style = psHint) then
                TimerNeeded := True;
       if not TimerNeeded then KillTimer(StatusBar.Handle, HINT_TIMER_ID);
    end;
}

    if (StatusBar.HandleAllocated) and (FStyle in [psDate,psTime,psDateTime]) then
    begin
       TimerNeeded := False;
       for i:= 0 to StatusBar.Panels.Count-1 do
          if (StatusBar.Panels[i]<>Self) and
             (StatusBar.Panels[i].Style in [psDate,psTime,psDateTime]) then
                TimerNeeded := True;
       if not TimerNeeded then KillTimer(StatusBar.Handle, TIMER_ID);
    end;
  if (FStyle <> Value) AND
     (StatusBar.HandleAllocated) and (FStyle = psProgressBar) then
        DestroyProgressBar(Self);
  if (FStyle <> Value) AND
     (StatusBar.HandleAllocated) and (FStyle = psAnimate) then
        DestroyAnimate(Self);

    FStyle := Value;
    case FStyle of

      psProgressBar: begin
                     CreateProgressBar(Self);
                     DrawControl;
                     StatusBar.ComponentExclusive(FComponent, self, False);
                     end;
      psAnimate    : begin
                     CreateAnimate(Self);
                     DrawControl;
                     StatusBar.ComponentExclusive(FComponent, self, False);
                     end;
//      psHint: if StatusBar.HandleAllocated and not (csDesigning in StatusBar.ComponentState) then
//        SetTimer(StatusBar.Handle, HINT_TIMER_ID, 100, nil);
      psDate,psTime,psDateTime:begin
                                if StatusBar.HandleAllocated and not (csDesigning in StatusBar.ComponentState) then
                                SetTimer(StatusBar.Handle, TIMER_ID, 1000, nil);
                               end;
      psRichEditStatus:
        if StatusBar.HandleAllocated and not (csDesigning in StatusBar.ComponentState) then
           SetTimer(StatusBar.Handle, RICHEDIT_TIMER_ID, 100, nil);
    end;
    Changed(False);
  end;
finally
  FCriticalSection.Leave;
end;
end;

procedure TDPv2StatusPanel.SetText(const Value: string);
begin
  if FText <> Value then
  begin
    FText := Value;
    PanelTextChanged(Value);
    Invalidate;
    TDPv2StatusPanels(FCollection).FStatusBar.UpdatePanels;
  end;
end;

procedure TDPv2StatusPanel.SetWidth(Value: Integer);
    var
        AWidth: Integer;
begin

  if FWidth <> Value then
  begin
    FWidth := Value;
    PaintWidth:=FWidth;
    StatusBar.Resize;    
    Changed(True);
  end;
end;

function TDPv2StatusPanel.StoreWidth: Boolean;
begin
  result := Width <> 0;
end;

procedure TDPv2StatusPanel.SetProgressBarProps(
  const Value: TDPv2ProgressBarProps);
begin
  FProgressBarProps := Value;
  If Control<>nil then begin
     TProgressBar(Control).Max:=FProgressBarProps.Max;
     TProgressBar(Control).Min:=FProgressBarProps.Min;
     TProgressBar(Control).Position:=FProgressBarProps.Position;
     TProgressBar(Control).Step:=FProgressBarProps.Step;
     TProgressBar(Control).Smooth:=FProgressBarProps.Smooth;
     Invalidate;
  end;
end;

procedure TDPv2StatusPanel.SetAnimateProps(
  const Value: TDPv2AnimateProps);
begin
  FAnimateProps := Value;
  If Control<>nil then begin
     TAnimate(Control).FileName :=FAnimateProps.AviFile;
     TAnimate(Control).Active   :=FAnimateProps.Active;
     Invalidate;
  end;
end;

procedure TDPv2StatusPanel.DestroyProgressBar(Sender: TObject);
begin
    If Assigned(TProgressBar(FComponent)) then
        TProgressBar(FComponent).Parent:=nil;
        TProgressBar(FComponent).Free;
    TProgressBar(FComponent):=nil;
    FProgressBarProps.Reset(Sender);

end;

procedure TDPv2StatusPanel.DestroyAnimate(Sender: TObject);
begin
    If Assigned(TAnimate(FComponent)) then
        TAnimate(FComponent).Parent:=nil;
        TAnimate(FComponent).Free;
    TAnimate(FComponent):=nil;
    FAnimateProps.Reset(Sender);
end;

{ TDPv2StatusPanels }

function TDPv2StatusPanels.Add: TDPv2StatusPanel;
begin
  result := TDPv2StatusPanel(inherited Add);
end;

constructor TDPv2StatusPanels.Create(StatusBar: TDPv2CustomStatusBar);
begin
  inherited Create(TDPv2StatusPanel);
  FStatusBar := StatusBar;
end;

function TDPv2StatusPanels.GetItem(Index: Integer): TDPv2StatusPanel;
begin
  result := TDPv2StatusPanel(inherited GetItem(Index));
end;

function TDPv2StatusPanels.GetOwner: TPersistent;
begin
  Result := FStatusBar;
end;

function TDPv2StatusPanels.PanelByName(AName: string): TDPv2StatusPanel;
var i: Integer;
begin
  result := nil;
  for i := 0 to Count - 1 do
    if Items[i].Name = AName then
      result := Items[i];

end;

procedure TDPv2StatusPanels.SetItem(Index: Integer; Value: TDPv2StatusPanel);
begin
    inherited SetItem(Index, Value);
end;

procedure TDPv2StatusPanels.Update(Item: TCollectionItem);
begin
    if Item <> nil then
        FStatusBar.UpdatePanel(Item.Index, true) else
    FStatusBar.UpdatePanels;
end;

{ TDPv2CustomStatusBar }

procedure TDPv2CustomStatusBar.ChangeScale(M, D: Integer);
begin

  if UseSystemFont then
    ScalingFlags := [sfTop];
  inherited;

end;

constructor TDPv2CustomStatusBar.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ControlStyle := [csCaptureMouse, csClickEvents, csDoubleClicks, csOpaque];
  ControlStyle:= ControlStyle + [csAcceptsControls];
  Color := clBtnFace;
  Height := 19;
  Align := alBottom;
  FPanels := TDPv2StatusPanels.Create(Self);
  FCanvas := TControlCanvas.Create;
  TControlCanvas(FCanvas).Control := Self;
  FSizeGrip := True;
  ParentFont := False;
  FUseSystemFont := True;
  FSimplePanel:=False;
  SyncToSystemFont;

  StatusBars.Add(self);
end;

procedure TDPv2CustomStatusBar.SyncToSystemFont;
begin
  if FUseSystemFont then
    Font := Screen.HintFont;
end;

procedure TDPv2CustomStatusBar.CreateParams(var Params: TCreateParams);
const
  GripStyles: array[Boolean] of DWORD = (CCS_TOP, SBARS_SIZEGRIP);
begin
  InitCommonControl(ICC_BAR_CLASSES);
  inherited CreateParams(Params);
  CreateSubClass(Params, STATUSCLASSNAME);
  with Params do
  begin
    Style := Style or GripStyles[FSizeGrip and (Parent is TCustomForm) and
      (TCustomForm(Parent).BorderStyle in [bsSizeable, bsSizeToolWin])];
    WindowClass.style := WindowClass.style and not CS_HREDRAW;
  end;

end;

procedure TDPv2CustomStatusBar.CreateWnd;
var i: Integer;
    FoundDate, FoundHint, FoundRichEdit: boolean;
begin
  inherited CreateWnd;
  UpdatePanels;
//  if FSimpleText <> '' then SendMessage(Handle, SB_SETTEXT, 255, Integer(PChar(FSimpleText)));
//  if FSimplePanel then SendMessage(Handle, SB_SIMPLE, 1, 0);

  FoundRichEdit:= False;
  FoundHint:= False;
  FoundDate:= False;
  if not (csDesigning in ComponentState) then
    for i := 0 to Panels.Count - 1 do
//      if (not FoundHint) and (Panels[i].Style = psHint) then
//      begin
//        SetTimer(Handle, HINT_TIMER_ID, 100, nil);
//        FoundHint:= True;
//      end 
//      else if (not FoundDate) and (Panels[i].Style in [psDate,psTime,psDateTime]) then
      if (not FoundDate) and (Panels[i].Style in [psDate,psTime,psDateTime]) then begin
        SetTimer(Handle, TIMER_ID, 1000, nil);
        FoundDate:= True;
      end
      else if (not FoundRichEdit) and (Panels[i].Style = psRichEditStatus) then
      begin
        SetTimer(Handle, RICHEDIT_TIMER_ID, 100, nil);
        FoundRichEdit:= True;
      end
end;

destructor TDPv2CustomStatusBar.Destroy;
begin
  if StatusBars<>nil then 
     StatusBars.Delete(StatusBars.IndexOf(self));
  FCanvas.Free;
  FPanels.Free;
  inherited Destroy;
end;

function TDPv2CustomStatusBar.DoHint: Boolean;
begin

end;

procedure TDPv2CustomStatusBar.DrawPanel(Panel: TDPv2StatusPanel; Rect: TRect);
begin
  Panel.FCanvas := Canvas;
  Panel.FRect := Rect;
  if SizeGrip and (Panels[Panels.Count-1]=Panel) then
     Rect.Right := Rect.Right-_Min(23,GetSystemMetrics(SM_CXVSCROLL)+1);
  Panel.Draw(Canvas, Rect);
  if Assigned(FOnDrawPanel) then FOnDrawPanel(Self, Panel, Rect);

end;

function TDPv2CustomStatusBar.ExecuteAction(Action: TBasicAction): Boolean;
begin
  if AutoHint and (Action is ThintAction) and not DoHint then
  begin
    if (Panels.Count > 0) then
      Panels[0].Text := ThintAction(Action).Hint;
    Result := True;
  end
  else Result := inherited ExecuteAction(Action);
end;

procedure TDPv2CustomStatusBar.FlipChildren(AllLevels: Boolean);
var
  Loop, FirstWidth, LastWidth: Integer;
  APanels: TDPv2StatusPanels;
begin
  if HandleAllocated and (Panels.Count > 0) then begin
    { Get the true width of the last panel }
    LastWidth := ClientWidth;
    FirstWidth := Panels[0].Width;
    for Loop := 0 to Panels.Count - 2 do Dec(LastWidth, Panels[Loop].Width);
    { Flip 'em }
    APanels := TDPv2StatusPanels.Create(Self);
    try
      for Loop := 0 to Panels.Count - 1 do with APanels.Add do
        Assign(Self.Panels[Loop]);
      for Loop := 0 to Panels.Count - 1 do
        Panels[Loop].Assign(APanels[Panels.Count - Loop - 1]);
    finally
      APanels.Free;
    end;
    { Set the width of the last panel }
    if Panels.Count > 1 then
    begin
      Panels[Panels.Count-1].Width := FirstWidth;
      Panels[0].Width := LastWidth;
    end;
    UpdatePanels;
  end;

end;

function TDPv2CustomStatusBar.GetSizeGrip: Boolean;
begin
   result := FSizeGrip and (Parent is TCustomForm) and
     (TForm(Parent).BorderStyle in [bsSizeable, bsSizeToolWin]);
end;

procedure TDPv2CustomStatusBar.SetImageList(const Value: TCustomImageList);
begin
  FImageList := Value;
end;

procedure TDPv2CustomStatusBar.SetPanels(const Value: TDPv2StatusPanels);
begin
  FPanels.Assign(Value);
end;

procedure TDPv2CustomStatusBar.SetSizeGrip(const Value: Boolean);
begin
  if FSizeGrip <> Value then
  begin
    FSizeGrip := Value;
    RecreateWnd;
  end;
end;

procedure TDPv2CustomStatusBar.SetUseSystemFont(const Value: Boolean);
begin
  FUseSystemFont := Value;
end;

procedure TDPv2CustomStatusBar.UpdatePanel(Index: Integer; Repaint: Boolean);
var
  Flags: Integer;
  S: string;
  PanelRect: TRect;
begin
  if HandleAllocated then
    with Panels[Index] do begin
      Flags := 0;
      case Bevel of
        pbNone: Flags := SBT_NOBORDERS;
        pbRaised: Flags := SBT_POPOUT;
      end;
      Flags := Flags or SBT_OWNERDRAW;
      s := Text;
//      case TextOptions.Alignment of
//        taCenter: s := #9 + S;
//        taRightJustify: s := #9#9 + S;
//      end;
      SendMessage(Handle, SB_SETTEXT, Index or Flags, Integer(PChar(S)));
      if Repaint then
      begin
        PanelRect := GetRect;
        InvalidateRect(Handle, @PanelRect, True);
      end;
    end;
end;

procedure TDPv2CustomStatusBar.UpdatePanels;
const
  MaxPanelCount = 128;
var
  I, Count, PanelPos: Integer;
  PanelEdges: array[0..MaxPanelCount - 1] of Integer;
begin
  Handle;
  if HandleAllocated then
  begin
    Count := Panels.Count;
    if Count > MaxPanelCount then Count := MaxPanelCount;
    if Count = 0 then
    begin
      PanelEdges[0] := -1;
      SendMessage(Handle, SB_SETPARTS, 1, Integer(@PanelEdges));
      SendMessage(Handle, SB_SETTEXT, 0, Integer(PChar('')));
    end else
    begin
      PanelPos := 0;
      for I := 0 to Count - 2 do
      begin
        Inc(PanelPos, Panels[I].PaintWidth);
        PanelEdges[I] := PanelPos;
      end;
      PanelEdges[Count - 1] := -1;
      SendMessage(Handle, SB_SETPARTS, Count, Integer(@PanelEdges));
      for I := 0 to Count - 1 do
          UpdatePanel(I, true);
    end;
  end;
end;

procedure TDPv2CustomStatusBar.DoRightToLeftAlignment(var Str: string;
  AAlignment: TAlignment; ARTLAlignment: Boolean);
begin
  if ARTLAlignment then ChangeBiDiModeAlignment(AAlignment);

  case AAlignment of
    taCenter: Insert(#9, Str, 1);
    taRightJustify: Insert(#9#9, Str, 1);
  end;
end;

procedure TDPv2CustomStatusBar.CMBiDiModeChanged(var Message: TMessage);
var
  Loop: Integer;
begin
  inherited;
  if HandleAllocated then begin
      for Loop := 0 to Panels.Count - 1 do
        if Panels[Loop].ParentBiDiMode then
          Panels[Loop].ParentBiDiModeChanged;
      UpdatePanels;
    end;

end;

procedure TDPv2CustomStatusBar.CMColorChanged(var Message: TMessage);
begin
  inherited;
  RecreateWnd;
end;

procedure TDPv2CustomStatusBar.CMParentFontChanged(var Message: TMessage);
begin
  inherited;
  if FUseSystemFont and ParentFont then FUseSystemFont := False;
end;

procedure TDPv2CustomStatusBar.CMSysColorChange(var Message: TMessage);
begin
  inherited;
  RecreateWnd;
end;

procedure TDPv2CustomStatusBar.CMSysFontChanged(var Message: TMessage);
begin
  inherited;
  SyncToSystemFont;
end;

procedure TDPv2CustomStatusBar.CMWinIniChange(var Message: TMessage);
begin
  inherited;
  if (Message.WParam = 0) or (Message.WParam = SPI_SETNONCLIENTMETRICS) then
    SyncToSystemFont;
end;

procedure TDPv2CustomStatusBar.CNDrawItem(var Message: TWMDrawItem);
  var
  SaveIndex: Integer;
  PanelEdges: array[0..255 - 1] of Integer;
  ACount: Integer;
begin
  FillChar(PanelEdges, SizeOf(PanelEdges), 0);
  ACount := SendMessage(Handle, SB_GETPARTS, Panels.Count, Integer(@PanelEdges));
  if ACount <> Panels.Count then RecreateWnd;

  with Message.DrawItemStruct^ do
  begin
    SaveIndex := SaveDC(hDC);
    FCanvas.Handle := hDC;
    FCanvas.Font := Font;
    FCanvas.Brush.Color := clBtnFace;
    FCanvas.Brush.Style := bsSolid;
    DrawPanel(Panels[itemID], rcItem);
    FCanvas.Handle := 0;
    RestoreDC(hDC, SaveIndex);
  end;
  Message.Result := 1;
end;

procedure TDPv2CustomStatusBar.WMGetTextLength(var Message: TWMGetTextLength);
begin
//  Message.Result := Length(FSimpleText);
end;

procedure TDPv2CustomStatusBar.WMSize(var Message: TWMSize);
var i: Integer;
begin
  FSizing := True;
  if (Parent = nil) or ([csLoading, csDestroying] * ComponentState <> []) then Exit;
  if not (csLoading in ComponentState) then Resize;
  for i := 0 to Panels.Count - 1 do
      Panels[i].Invalidate;
  FSizing := False;
  Invalidate;
end;

procedure TDPv2CustomStatusBar.Invalidate;
begin
  if not (csLoading in ComponentState) then inherited;
end;

procedure TDPv2CustomStatusBar.ComponentExclusive(Value: TComponent;
  Panel: TDPv2StatusPanel; ThisStatusBarOnly: Boolean);
  var
     i:integer;
begin
  If Value= nil then exit;
  for i := 0 to Panels.Count - 1 do
    if (Panels[i].Component = Value) and (Panels[i] <> Panel) then
      Panels[i].Component := nil;

  if not ThisStatusBarOnly then for i := 0 to StatusBars.Count - 1 do
    if StatusBars[i] <> self then
      TDPv2CustomStatusBar(StatusBars[i]).ComponentExclusive(Value, Panel, True);
end;

procedure TDPv2CustomStatusBar.DestroyWnd;
begin
  SendMessage(Handle, SB_SETTEXT, 0, Integer(PChar('')));
  KillTimer(Handle, TIMER_ID);
  KillTimer(Handle, HINT_TIMER_ID);
  KillTimer(Handle, RICHEDIT_TIMER_ID);
  inherited DestroyWnd;

end;

procedure TDPv2CustomStatusBar.SetSimplePanel(const Value: Boolean);
begin
     // Always a NON Simple Panel. 
end;

{ TDPv2ProgressBarProps }

procedure TDPv2ProgressBarProps.Assign(Source: TPersistent);
begin
  inherited;

end;

constructor TDPv2ProgressBarProps.Create;
begin
    FMax      :=100;
    FMin      :=0;
    FPosition :=0;
    FSmooth   :=True;
    FStep     :=10;
end;

destructor TDPv2ProgressBarProps.Destroy;
begin
  inherited;
end;

procedure TDPv2ProgressBarProps.Reset(Sender: TObject);
begin
    Max      := 100;
    Min      := 0;
    Position := 0;
    Smooth   := True;
    Step     := 10;
end;

procedure TDPv2ProgressBarProps.SetMax(const Value: Integer);
begin
  FMax := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2ProgressBarProps.SetMin(const Value: Integer);
begin
  FMin := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2ProgressBarProps.SetOnChange(const Value: TNotifyEvent);
begin
  FOnChange := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2ProgressBarProps.SetPosition(const Value: Integer);
begin
  FPosition := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);  
end;

procedure TDPv2ProgressBarProps.SetSmooth(const Value: Boolean);
begin
  FSmooth := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2ProgressBarProps.SetStep(const Value: Integer);
begin
  FStep := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2AnimateProps.Assign(Source: TPersistent);
begin
  inherited;

end;

constructor TDPv2AnimateProps.Create;
begin
    FAviFile := '';
    FActive  := False;
end;

destructor TDPv2AnimateProps.Destroy;
begin
  inherited;
end;

procedure TDPv2AnimateProps.Reset(Sender: TObject);
begin
    FAviFile := '';
    FActive  := False;
end;

procedure TDPv2AnimateProps.SetOnChange(const Value: TNotifyEvent);
begin
  FOnChange := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2AnimateProps.SetAviFile(const Value: String);
begin
  FAviFile := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

procedure TDPv2AnimateProps.SetActive(const Value: Boolean);
begin
  FActive := Value;
  If Assigned(FOnChange) then
      FOnChange(Self);
end;

initialization
  StatusBars := TList.Create;
finalization
  StatusBars.Free;
  StatusBars:= nil;
end.
 
is this the whole unit?

What is the 'procedure' left over at the bottom?

Where is your

end.



Leslie
 
Take a look at

Project | Options, tab=Conditionals/directories entry Unit output directory

if it doesn't exist, you get that message.



Regards and HTH,
JGS
 
Sorry, if it is there, see if there is the same .dcu in there already and it is perhaps marked read-only.



Regards and HTH,
JGS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top