UNIT Ucfgprgm; {----------------------------------------------------------------------------- NOM DE L'UNITE : UCFGPRGM.PAS BUT : Configuration générale du programme AUTEUR : Stéphane Claus DATE : Décembre 1996 MODIFIE LE : 12.04.1997 - EDT:01 RAISON : - Ajout de commentaires REMARQUES : -----------------------------------------------------------------------------} {=============================================================================} INTERFACE {============================================== I N T E R F A C E } {=============================================================================} USES SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls, Forms, Dialogs, DigDisp, StdCtrls, Buttons; TYPE TfrmCfgProgramme = CLASS(TForm) digdspTitre: TDigitalDisplay; bitbtnOK: TBitBtn; bitbtnAide: TBitBtn; ColorDialog: TColorDialog; grpbxDebug: TGroupBox; chkbxModeDebug: TCheckBox; bitbtnCouleurDebug: TBitBtn; grpbxEtatPorts: TGroupBox; chkbxAffichageEtatPorts: TCheckBox; scrlbarIntervalleRefreshPorts: TScrollBar; lblIntervalle: TLabel; grpbxBullesAides: TGroupBox; chkbxInfobulles: TCheckBox; PROCEDURE bitbtnCouleurDebugClick(Sender: TObject); PROCEDURE FormActivate(Sender: TObject); PROCEDURE FormClose(Sender: TObject; var Action: TCloseAction); PROCEDURE scrlbarIntervalleRefreshPortsChange(Sender: TObject); PRIVATE { Private-déclarations } PUBLIC { Public-déclarations } END; {CLASS} VAR frmCfgProgramme: TfrmCfgProgramme; {=============================================================================} IMPLEMENTATION {================================= I M P L E M E N A T I O N } {=============================================================================} {$R *.DFM} USES UPrincpl; PROCEDURE TfrmCfgProgramme.FormActivate(Sender: TObject); {----------------------------------------------------------------------------- BUT ........... : Initialisation de la fiche en fonction des paramètres actuels du programme ENTREE ........ : -- SORTIE ........ : -- EFFETS DE BORDS : -- REMARQUE(S) ... : -- -----------------------------------------------------------------------------} BEGIN Caption := Application.Title; { Titre de la fenêtre } bitbtnOK.ShowHint := affichehint; { Affichage des Hint ? } bitbtnAide.ShowHint := affichehint; chkbxModeDebug.ShowHint := affichehint; bitbtnCouleurDebug.ShowHint := affichehint; chkbxAffichageEtatPorts.ShowHint := affichehint; scrlbarIntervalleRefreshPorts.ShowHint := affichehint; chkbxInfobulles.ShowHint := affichehint; ColorDialog.Color := debugcolor; { Init. en f(x) des paramètres du prog. } chkbxModeDebug.Checked := debugmode; scrlbarIntervalleRefreshPorts.Position := debugdelaietatports; lblIntervalle.Caption := 'Intervalle = ' + IntToStr(debugdelaietatports); lblIntervalle.Caption := lblIntervalle.Caption + ' [ms]'; chkbxAffichageEtatPorts.Checked := debugetatports; chkbxInfobulles.Checked := affichehint; END; {PROCEDURE FormActivate} PROCEDURE TfrmCfgProgramme.bitbtnCouleurDebugClick(Sender: TObject); {----------------------------------------------------------------------------- BUT ........... : Change la couleur des fenêtres en mode Debug ENTREE ........ : -- SORTIE ........ : -- EFFETS DE BORDS : -- REMARQUE(S) ... : Le composant Boîte de dialogue des couleurs (ColorDialog) crée une boîte de dialogue Couleurs qui vous permet de définir, en mode exécution, la couleur de n'importe quel composant doté de la propriété Color. -----------------------------------------------------------------------------} BEGIN IF ColorDialog.Execute THEN BEGIN { Appel de la boite de dialogue } debugcolor := ColorDialog.Color; { Récupère la couleur choisie } END; {IF} END; {PROCEDURE bitbtnCouleurDebugClick} PROCEDURE TfrmCfgProgramme.FormClose(Sender: TObject; VAR Action: TCloseAction); {----------------------------------------------------------------------------- BUT ........... : Mise à jour des constantes du programme lors de la fermeture de la fiche ENTREE ........ : -- SORTIE ........ : -- EFFETS DE BORDS : -- REMARQUE(S) ... : Le type TCloseEvent de OnClose a un paramètre Action. La valeur du paramètre Action détermine si la fiche peut effectivement être fermée. Les valeurs possibles de Action sont : Valeur Signification ----------------------------------------------------------- caNone La fiche n'a pas le droit de se fermer, donc il ne se passe rien. caHide La fiche n'est pas fermée, juste cachée. L'application peut toujours accéder à une fiche cachée. caFree La fiche est fermée et la mémoire allouée à la fiche libérée. caMinimize La fiche n'est pas fermée, juste réduite en icône. C'est l'action par défaut des fiches enfant MDI. -----------------------------------------------------------------------------} BEGIN debugmode := chkbxModeDebug.Checked; debugdelaietatports := scrlbarIntervalleRefreshPorts.Position; debugetatports := chkbxAffichageEtatPorts.Checked; affichehint := chkbxInfobulles.Checked; END; {PROCEDURE FormClose} PROCEDURE TfrmCfgProgramme.scrlbarIntervalleRefreshPortsChange(Sender: TObject); {----------------------------------------------------------------------------- BUT ........... : Mise à jour du label Intervalle de rafraîchissement de l'état des ports ENTREE ........ : -- SORTIE ........ : -- EFFETS DE BORDS : -- REMARQUE(S) ... : -- -----------------------------------------------------------------------------} BEGIN { Lit la position actuelle } debugdelaietatports := scrlbarIntervalleRefreshPorts.Position; { Conversion en une string } lblIntervalle.Caption := 'Intervalle = ' + IntToStr(debugdelaietatports); { Ajout de l'unité } lblIntervalle.Caption := lblIntervalle.Caption + ' [ms]'; END; {PROCEDURE scrlbarIntervalleRefreshPortsChange} {=============================================================================} { INITIALISATIONS ------------------------------------------- Initialisations } {=============================================================================} INITIALIZATION END. {UNIT Ucfgprgm}