1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
void __fastcall TFormJournal::FormShow(TObject *Sender)
{
FormJournal->StringGridAlertes->Cells[0][0] = " Etat";
FormJournal->StringGridAlertes->Cells[1][0] = " Date";
FormJournal->StringGridAlertes->Cells[2][0] = " Heure";
FormJournal->StringGridAlertes->Cells[3][0] = " Seuils Définis";
FormJournal->StringGridAlertes->Cells[4][0] = " Dépassements";
FormJournal->StringGridAlertes->Cells[5][0] = " Alerte Lue";
struct tm *Time;
RepertoireApplication = ExtractFilePath(Application->ExeName);
NumSerie = FormJournal->ComboBoxNumSerie->Items->Strings[FormJournal->ComboBoxNumSerie->ItemIndex];
Journal = RepertoireApplication+"\\Alertes\\" + NumSerie + ".al";
IconeValider = RepertoireApplication + "IconeValider.bmp";
IconeAlerte = RepertoireApplication + "IconeAlerte.bmp";
IconeChecked = RepertoireApplication + "checked.bmp";
IconeUnchecked = RepertoireApplication + "unchecked.bmp";
FichierJournal = new TIniFile(Journal);
ListeJournal = new TStringList();
ListeClesValeurs = new TStringList();
FichierJournal->ReadSections(ListeJournal);
for (long int i = 0; i < ListeJournal->Count; i++)
{
// Modifs
FichierJournal->ReadSectionValues(ListeJournal->Strings[i], ListeClesValeurs);
//Lecture date et heure
time_t DataHeure = StrToInt(FichierJournal->ReadString(ListeJournal->Strings[i] ,"DateHeure",NULL));
Time = localtime(&DataHeure);
AnsiString Heure;
//Affichage dans le StringGrid
FormJournal->StringGridAlertes->Cells[1][i+1] = Heure.sprintf("%02d/%02d/%02d", Time->tm_mday, (Time->tm_mon+1) ,(Time->tm_year+1900));
FormJournal->StringGridAlertes->Cells[2][i+1] = Heure.sprintf("%02d:%02d:%02d", Time->tm_hour, Time->tm_min, Time->tm_sec);
AnsiString Seuils = "";
AnsiString Depassements = "";
for (int k = 2; k < ListeClesValeurs->Count; k = k+2)
{
if (k > 2)
{
Seuils = Seuils + "\n";
Depassements = Depassements + "\n";
}
Seuils = Seuils + ListeClesValeurs->Strings[k];
//Depassements = Depassements + ListeClesValeurs->Strings[k+1];
Depassements = ListeClesValeurs->Strings[k+1];
}
Seuils = AnsiReplaceText(Seuils, "Seuil ", "");
FormJournal->StringGridAlertes->Cells[3][i+1] = Seuils;
ComposantsJournal.PlacementComboBox(i+1);
Combo = (TComboBox *) ComposantsJournal.ListeComposantsAlertesDepassement->Items[i];
Combo->Parent = this;
FormJournal->StringGridAlertes->Cells[4][i+1] = Combo->Items->Add(i);
Combo->ItemIndex = 0;
//FormJournal->StringGridAlertes->Cells[4][i+1] = Depassements;
Result = FichierJournal->ReadBool(ListeJournal->Strings[i], "Alerte", 1);
FormJournal->StringGridAlertes->Objects[0][i+1] = (TObject *) Result;
FormJournal->StringGridAlertes->Objects[5][i+1] = (TObject *) Result;
FormJournal->StringGridAlertes->RowCount = ListeJournal->Count+1;
}
delete (ListeJournal);
delete (FichierJournal);
} |
Partager