unit uViewBase;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uGUIBase, uCustomView, JvComponent, JvFormAutoSize;

type
  IViewBase = interface(ICustomView)
    ['{724D4E2A-909F-418A-9677-8A7B825D639A}']
    procedure Refresh;
  end;

  TfrViewBase = class(TCustomView, IViewBase)
  protected
    procedure SetReadOnly(Value: Boolean); override;
  public
    procedure Refresh; virtual;
  end;

implementation

{$R *.dfm}


uses
  cxDBEdit, cxControls, dxLayoutControl;

{ TfrViewBase }

procedure TfrViewBase.Refresh;
begin
  //
end;

procedure TfrViewBase.SetReadOnly(Value: Boolean);
var
  i: integer;
begin
  inherited;

  if (csLoading in Self.ComponentState) then
    Exit;

  for i:=0 to Self.ComponentCount-1 do
  begin
     if (Self.Components[i] is TfrViewBase) then
       (Self.Components[i] as TfrViewBase).ReadOnly := Self.ReadOnly;

     if (Self.Components[i] is TcxControl)
        and (not (Self.Components[i] Is TdxLayoutControl)) then
        (Self.Components[i] as TcxControl).Enabled := not Self.ReadOnly;
  end;
end;

end.
