Показать сообщение отдельно

  #4  
Старый 08.06.2010, 01:32
diznt
Постоянный
Регистрация: 31.01.2008
Сообщений: 643
С нами: 9619229

Репутация: 445


По умолчанию

Цитата:
Сообщение от Leon2009  
Код:
var i:integer;
begin
i:=0;
if CheckBox1.Checked= true then i:=i+1;
if CheckBox2.Checked= true then i:=i+1;
if CheckBox3.Checked= true then i:=i+1;
if CheckBox4.Checked= true then i:=i+1;
if CheckBox5.Checked= true then i:=i+1;
if CheckBox6.Checked= true then i:=i+1;
label1.Caption:=inttostr(i);
if i>=3 then label2.Caption:='bolshe ili ravno 3';
спасибо!
а если 1000 чексов?
т.е одинаковый обработчик?
Код:
var
 i, i2: integer;
begin
 i2:=0;

 for i:=1 to 8 do
  begin
    if TCheckBox(FindComponent('CheckBox'+inttostr(i))).Checked=true then
     inc(i2);
  end;

 if i2 = 4 then ShowMessage('Выделенно 4 чекбокса');
end;
 
Ответить с цитированием