unit USujet;

interface

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

type
  TSujetDLGForm = class(TForm)
    Label1: TLabel;
    NomSujet: TEdit;
    BitBtn2: TBitBtn;
    BitBtn1: TBitBtn;
    SujetALPHATimer: TTimer;
    procedure SujetALPHATimerTimer(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
    Operation : string;//C:creation,M:Modification
  end;

var
  SujetDLGForm: TSujetDLGForm;

implementation

uses UDocometre, XMLClasses;

{$R *.dfm}

procedure TSujetDLGForm.SujetALPHATimerTimer(Sender: TObject);
begin
  if ALphaBlendValue < 240
  then ALphaBlendValue := ALphaBlendValue + 40
  else begin
    ALphaBlendValue := 255;
    SujetALPHATimer.Enabled := false;
  end;
end;

procedure TSujetDLGForm.FormShow(Sender: TObject);
var ASujet : IXMLSUJETType;
    i,index : integer;
begin
  ALphaBlendValue := 0;
  SujetALPHATimer.Enabled := true;
  if Operation = 'M' then
  begin
    //Recup n° ligne = n°Session
    i := DocoForm.OrgaFrame.SujetsListBox.ItemIndex;
    //Maj champs
    ASujet := DocDOCOMETRE.SUJETS[i];
    NomSujet.Text :=   ASujet.NOM;
  end;
  if Operation = 'C' then
  begin
    NomSujet.Text := 'SUJET' + inttostr(DocoForm.OrgaFrame.SujetsListBox.Count + 1);
  end;
end;

end.
