// Unité pour la configuration du décodeur Stéphane Ravaux // http://stephane.ravaut.free.fr/Train_miniature/Decodeurs/Decodeur_DCC_Signaux_complexes_SNCF.html unit UnitSR; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls , UnitPrinc, UnitConfig, Buttons; type TFormSR = class(TForm) LabelAdrSR1: TLabel; ComboBoxAdr1: TComboBox; Label1: TLabel; Label2: TLabel; ComboBoxAdr2: TComboBox; Label300: TLabel; Label301: TLabel; Label302: TLabel; Shape1: TShape; LabelAdrSR2: TLabel; Label3: TLabel; Label4: TLabel; Label303: TLabel; LabelCV1: TLabel; LabelCV2: TLabel; LabelCV3: TLabel; LabelCV4: TLabel; ComboBoxAdr3: TComboBox; ComboBoxAdr4: TComboBox; LabelCV5: TLabel; LabelCV6: TLabel; LabelCV7: TLabel; LabelCV8: TLabel; Shape2: TShape; LabelAdrSR3: TLabel; Label5: TLabel; Label6: TLabel; ComboBoxAdr5: TComboBox; ComboBoxAdr6: TComboBox; LabelCV9: TLabel; LabelCV10: TLabel; LabelCV11: TLabel; LabelCV12: TLabel; Shape3: TShape; LabelAdrSR4: TLabel; Label7: TLabel; Label8: TLabel; ComboBoxAdr7: TComboBox; ComboBoxAdr8: TComboBox; LabelCV13: TLabel; LabelCV14: TLabel; LabelCV15: TLabel; LabelCV16: TLabel; Shape4: TShape; LabelAdrSR5: TLabel; Label9: TLabel; Label10: TLabel; ComboBoxAdr9: TComboBox; ComboBoxAdr10: TComboBox; LabelCV17: TLabel; LabelCV18: TLabel; LabelCV19: TLabel; LabelCV20: TLabel; Shape5: TShape; LabelAdrSR6: TLabel; Label11: TLabel; Label12: TLabel; ComboBoxAdr11: TComboBox; ComboBoxAdr12: TComboBox; LabelCV21: TLabel; LabelCV22: TLabel; LabelCV23: TLabel; LabelCV24: TLabel; Shape6: TShape; LabelAdrSR7: TLabel; Label13: TLabel; Label14: TLabel; LabelCV25: TLabel; LabelCV26: TLabel; LabelCV27: TLabel; LabelCV28: TLabel; ComboBoxAdr13: TComboBox; ComboBoxAdr14: TComboBox; Shape7: TShape; LabelAdrSR8: TLabel; Label15: TLabel; Label16: TLabel; LabelCV29: TLabel; LabelCV30: TLabel; LabelCV31: TLabel; LabelCV32: TLabel; ComboBoxAdr15: TComboBox; ComboBoxAdr16: TComboBox; LabelErreur: TLabel; Label900: TLabel; EditNEsignal: TEdit; Button1: TButton; Shape8: TShape; procedure FormActivate(Sender: TObject); procedure ComboBoxAdr1Change(Sender: TObject); procedure ComboBoxAdr2Change(Sender: TObject); procedure ComboBoxAdr3Change(Sender: TObject); procedure ComboBoxAdr4Change(Sender: TObject); procedure ComboBoxAdr5Change(Sender: TObject); procedure ComboBoxAdr6Change(Sender: TObject); procedure ComboBoxAdr7Change(Sender: TObject); procedure ComboBoxAdr8Change(Sender: TObject); procedure ComboBoxAdr9Change(Sender: TObject); procedure ComboBoxAdr10Change(Sender: TObject); procedure ComboBoxAdr11Change(Sender: TObject); procedure ComboBoxAdr12Change(Sender: TObject); procedure ComboBoxAdr13Change(Sender: TObject); procedure ComboBoxAdr14Change(Sender: TObject); procedure ComboBoxAdr15Change(Sender: TObject); procedure ComboBoxAdr16Change(Sender: TObject); procedure FormCreate(Sender: TObject); procedure EditNEsignalChange(Sender: TObject); procedure Button1Click(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var FormSR: TFormSR; Adr,IndexSig : integer; //etatsDefSR : array[1..16] of integer; // états par défaut du décodeur SR procedure couleurs_SR; implementation {$R *.dfm} // efface/affiche les composants en fonction du nombre d'adresses (de 1 à 8) procedure efface(nadr : integer); var i : integer; c : tComboBox; Lb : tLabel; s : string; begin for i:=1 to 16 do begin s:='ComboBoxAdr'+intToSTR(i); c:=formSR.findComponent(s) as tComboBox; c.Visible:=(i-1)<2*nadr ; s:='Label'+intToSTR(i); Lb:=formSR.findComponent(s) as tLabel; Lb.Visible:=i-1<2*nadr; s:='LabelCV'+intToSTR(i*2-1); Lb:=formSR.findComponent(s) as tLabel; Lb.Visible:=i-1<2*nadr; s:='LabelCV'+intToSTR(i*2); Lb:=formSR.findComponent(s) as tLabel; Lb.Visible:=i-1<2*nadr; end; for i:=1 to 8 do begin s:='LabelAdrSR'+intToSTR(i); Lb:=formSR.findComponent(s) as tLabel; Lb.visible:=(i-1)0) or (i<1) or (i>8) then exit; Signaux[ligneClicSig+1].na:=i; maj_db; efface(i); end; procedure TFormSR.Button1Click(Sender: TObject); begin close; end; begin end.