unit UI_Form_Data;
interface
uses
Windows, Messages,
SysUtils, Variants, Classes,
Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
UI_Form_Base, Container_Data,
Vcl.ComCtrls;
type
TUIData_Form =
class( TUIBase_Form )
RefreshData_Timer : TTimer;
Value1_Label : TLabel;
Value2_Label : TLabel;
Value3_Label : TLabel;
Value1_ProgressBar : TProgressBar;
Value2_ProgressBar : TProgressBar;
Value3_ProgressBar : TProgressBar;
procedure RefreshData_TimerTimer( Sender : TObject );
procedure FormClose( Sender : TObject;
var Action : TCloseAction );
private
FContainer : TDataContainer;
procedure SetContainer(
const Value : TDataContainer );
procedure PresentData( AData : TData );
public
property Container : TDataContainer
read FContainer
write SetContainer;
end;
var
UIData_Form : TUIData_Form;
implementation
{$R *.dfm}
{ TUIData_Form }
procedure TUIData_Form.FormClose( Sender : TObject;
var Action : TCloseAction );
begin
inherited;
Action := caFree;
end;
procedure TUIData_Form.PresentData( AData : TData );
begin
Value1_Label.Caption := IntToStr( AData.Value1 );
Value1_ProgressBar.Position := AData.Value1;
Value2_Label.Caption := IntToStr( AData.Value2 );
Value2_ProgressBar.Position := AData.Value2;
Value3_Label.Caption := IntToStr( AData.Value3 );
Value3_ProgressBar.Position := AData.Value3;
end;
procedure TUIData_Form.RefreshData_TimerTimer( Sender : TObject );
begin
inherited;
PresentData( FContainer.Data );
end;
procedure TUIData_Form.SetContainer(
const Value : TDataContainer );
begin
if Value = FContainer
then
Exit;
FContainer := Value;
RefreshData_Timer.Enabled := Assigned( FContainer );
end;
end.