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
|
//le.h
#ifndef Unit72H
#define Unit72H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
//---------------------------------------------------------------------------
class TForm72 : public TForm
{
__published: // Composants gérés par l'EDI
TGroupBox *Gb;
TComboBox *ComboBox1;
TButton *Button1;
TButton *Button2;
TButton *Button3;
TCheckBox *CheckBox1;
TCheckBox *CheckBox2;
TCheckBox *CheckBox3;
TCheckBox *CheckBox4;
TCheckBox *CheckBox5;
TCheckBox *CheckBox6;
void __fastcall Button1Click(TObject *Sender);
void __fastcall Button2Click(TObject *Sender);
void __fastcall Button3Click(TObject *Sender);
private: // Déclarations utilisateur
public: // Déclarations utilisateur
__fastcall TForm72(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm72 *Form72;
//---------------------------------------------------------------------------
#endif
//le cpp
#include <vcl.h>
#pragma hdrstop
#include "Unit72.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm72 *Form72;
__fastcall TForm72::TForm72(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm72::Button1Click(TObject *Sender)
{
// bouton Check
try
{
dynamic_cast <TCheckBox*>(Gb->Controls[StrToInt(ComboBox1->Items->operator [](ComboBox1->ItemIndex))-1])->Checked=true;
}
catch (EConvertError &E)
{
}
}
//---------------------------------------------------------------------------
void __fastcall TForm72::Button2Click(TObject *Sender)
{
// bouton UnCheck
try
{
dynamic_cast <TCheckBox*>(Gb->Controls[StrToInt(ComboBox1->Items->operator [](ComboBox1->ItemIndex))-1])->Checked=false;
}
catch (EConvertError &E)
{
}
}
//---------------------------------------------------------------------------
void __fastcall TForm72::Button3Click(TObject *Sender)
{
// bouton All
for (int n=0; n <Gb->ControlCount; n++) {
dynamic_cast <TCheckBox*>(Gb->Controls[n])->Checked=true;
}
}
//--------------------------------------------------------------------------- |
Partager