unit USession;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Buttons;

type
  TSessionDLGForm = class(TForm)
    SessionALPHATimer: TTimer;
    Label1: TLabel;
    NomSession: TEdit;
    Label2: TLabel;
    NBEssais: TEdit;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    procedure FormShow(Sender: TObject);
    procedure SessionAlphaTimerTimer(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
    Operation : string;//C:creation,M:Modification
  end;

var
  SessionDLGForm: TSessionDLGForm;

implementation

uses UDocometre, XMLClasses;

{$R *.dfm}

procedure TSessionDLGForm.SessionAlphaTimerTimer(Sender: TObject);
begin
  if ALphaBlendValue < 240
  then ALphaBlendValue := ALphaBlendValue + 40
  else begin
    ALphaBlendValue := 255;
    SessionAlphaTimer.Enabled := false;
  end;
end;

procedure TSessionDLGForm.FormShow(Sender: TObject);
var ASession : IXMLSESSIONType;
    i : integer;
begin
  ALphaBlendValue := 0;
  SessionAlphaTimer.Enabled := true;
  if Operation = 'M' then
  begin
    //Recup n° ligne = n°Session
    i := DocoForm.OrgaFrame.SelectedSessionRow - 1 ;
    //Maj champs
    ASession := DocDOCOMETRE.SESSIONS.Items[i];
    NomSession.Text :=   ASession.NOM;
    NBEssais.Text := inttostr(ASession.ESSAIS.Count);
  end;
  if Operation = 'C' then
  begin
    NomSession.Text := 'SESSION' + inttostr(DocoForm.OrgaFrame.SessionsStringGrid.RowCount);
    NBEssais.Text := '1';
  end;
end;

end.
