unit AdvSmooth;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes, IWControl,
  IWAdvToolButton, IWVCLBaseControl, IWBaseControl, IWBaseHTMLControl,
  IWCompLabel, LeftFrame, Controls, Forms, TopFrame, IWCompRectangle,
  IWCompEdit, IWMultiColumnComboBox, IWHelpTip,
  IWCompListbox, IWCompButton, jpeg, IWCompExtCtrls,
  IWAdvSelector, IWCompRadioButton, iwledlabel, iwLabel, iwgauge, iwTimeLine,
  IWAdvSmoothTimeLine, IWAdvStyleIF, windows;

type
  TformAdvSmooth = class(TIWAppForm)
    FrameTopFrame1: TFrameTopFrame;
    FrameLeftFrame1: TFrameLeftFrame;
    IWLabel7: TIWLabel;
    TIWSmoothTimeLine1: TTIWSmoothTimeLine;
    TIWSmoothGauge1: TTIWSmoothGauge;
    TIWSmoothLabel1: TTIWSmoothLabel;
    IWButton2: TIWButton;
    IWLabel1: TIWLabel;
    IWComboBox1: TIWComboBox;
    TIWSmoothLEDLabel1: TTIWSmoothLEDLabel;
    IWLabel2: TIWLabel;
    IWLabel3: TIWLabel;
    IWLabel4: TIWLabel;
    IWRadioButton1: TIWRadioButton;
    IWRadioButton2: TIWRadioButton;
    IWLabel5: TIWLabel;
    procedure IWAppFormCreate(Sender: TObject);
    procedure IWButton2AsyncClick(Sender: TObject; EventParams: TStringList);
    procedure IWComboBox1AsyncChange(Sender: TObject; EventParams: TStringList);
    procedure TIWSmoothTimeLine1AsyncClick(Sender: TObject;
      Position: TDateTime);
    procedure TIWSmoothTimeLine1AsyncIndicatorClick(Sender: TObject;
      indicator: TIWAdvSmoothTimeLineBarIndicator);
    procedure TIWSmoothTimeLine1AsyncSectionClick(Sender: TObject;
      section: TIWAdvSmoothTimeLineBarSection);
    procedure TIWSmoothGauge1AsyncValueChanged(Sender: TObject; value: Double);
    procedure IWRadioButton1AsyncClick(Sender: TObject;
      EventParams: TStringList);
    procedure IWRadioButton2AsyncClick(Sender: TObject;
      EventParams: TStringList);
  public
  end;

implementation

{$R *.dfm}

procedure TformAdvSmooth.IWAppFormCreate(Sender: TObject);
begin

  FrameTopFrame1.Align := alTop;
  FrameLeftFrame1.Align := alLeft;

  with TIWSmoothTimeLine1.Appearance.TimeLineSections.Add do
  begin
    StartTime := EncodeDate(2009, 7, 1);
    EndTime := EncodeDate(2009, 9, 1);
    Caption := 'Holiday';
  end;
  with TIWSmoothTimeLine1.Appearance.TimeLineIndicators.Add do
  begin
    Position := EncodeDate(2009, 12, 10);
    Annotation := 'Birthday Pieter !';
  end;

  TIWSmoothTimeLine1.SetComponentStyle(tsWindows7);
  TIWSmoothGauge1.SetComponentStyle(tsWindows7);
  IWComboBox1.ItemIndex := 11;
  IWRadioButton1.Checked := true;
end;


procedure TformAdvSmooth.IWButton2AsyncClick(Sender: TObject;
  EventParams: TStringList);
var
  c: integer;
begin
  c := Random(100);
  TIWSmoothGauge1.Appearance.Value := c;
  TIWSmoothLEDLabel1.Appearance.Caption.Value := c;
end;

procedure TformAdvSmooth.IWComboBox1AsyncChange(Sender: TObject;
  EventParams: TStringList);
begin
  TIWSmoothGauge1.SetComponentStyle(TTMSStyle(IWComboBox1.ItemIndex));
  TIWSmoothTimeLine1.SetComponentStyle(TTMSStyle(IWComboBox1.ItemIndex));
end;

procedure TformAdvSmooth.IWRadioButton1AsyncClick(Sender: TObject;
  EventParams: TStringList);
begin
  TIWSmoothLabel1.Appearance.Caption.Picture.LoadFromFile(WebApplication.ApplicationPath+ 'wwwroot\Files\texture1.png');
  TIWSmoothLabel1.Appearance.Caption.Font.Name := 'Tahoma';
end;

procedure TformAdvSmooth.IWRadioButton2AsyncClick(Sender: TObject;
  EventParams: TStringList);
begin
  TIWSmoothLabel1.Appearance.Caption.Picture.LoadFromFile(WebApplication.ApplicationPath+'wwwroot\Files\texture2.png');
  TIWSmoothLabel1.Appearance.Caption.Font.Name := 'Comic Sans MS';
end;

procedure TformAdvSmooth.TIWSmoothGauge1AsyncValueChanged(Sender: TObject;
  value: Double);
begin
  TIWSmoothLEDLabel1.Appearance.Caption.Value := TIWSmoothGauge1.Appearance.Value;
end;

procedure TformAdvSmooth.TIWSmoothTimeLine1AsyncClick(Sender: TObject;
  Position: TDateTime);
var
  p: TDateTime;
begin
  p := Position;
  with TIWSmoothTimeLine1.Appearance.TimeLineIndicators.Add do
  begin
    Position := p;
    Annotation := DateToStr(p);
    AnnotationColor := RGB(Random(255), Random(255), Random(255));
  end;
  IWLabel3.Caption := 'Indicator Inserted at ' + datetostr(p);
  TIWSmoothLabel1.Appearance.Caption.Text := IwLabel3.Caption;
end;

procedure TformAdvSmooth.TIWSmoothTimeLine1AsyncIndicatorClick(Sender: TObject;
  indicator: TIWAdvSmoothTimeLineBarIndicator);
begin
  IWLabel3.Caption := 'Indicator clicked: ' + indicator.Annotation;
  TIWSmoothLabel1.Appearance.Caption.Text := IwLabel3.Caption;
end;

procedure TformAdvSmooth.TIWSmoothTimeLine1AsyncSectionClick(Sender: TObject;
  section: TIWAdvSmoothTimeLineBarSection);
begin
  IWLabel3.Caption := 'Section clicked: ' + section.Caption;
  TIWSmoothLabel1.Appearance.Caption.Text := IwLabel3.Caption;
end;

end.
