Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Delphi: Для новичков > Проскакивает переменную


Автор: Ospa 10.2.2008, 16:18
Код

procedure TForm1.RadioButton1Click(Sender: TObject);
var
qwer: boolean;
begin
qwer:=true;
if qwer=false then exit;
if radiobutton1.Checked=false then del_otv(labelededit2.Text);
if radiobutton1.Checked=true then
  begin
    if radiobutton2.Checked=true and radiobutton3.Checked=true and radiobutton4.Checked=true and radiobutton5.Checked=true then
      begin
        qwer:=false;//вот эту парашу тупо проскакивет не хуа не понимаю че происходит.
        showmessage('âû ó âàñ âûáðàííî ìàêñèìàëüíîå êîëëè÷åñòâî ïðàâèëüíûõ îòâåòîâ.');
        radiobutton1.Checked:=false;
      end
    else  add_otv(labelededit2.Text);
  end;
//otv:=labelededit2.Text;
//redaktotv:=otv;
end;

чет я недогоняю че он не меняет значение переменной а тупо игнорирует параметр ваще ахтунг smile 

Автор: Rrader 10.2.2008, 16:46
Project-Options-Compiler-Optimization
 smile 

Автор: Ospa 10.2.2008, 17:05
Цитата(Rrader @ 10.2.2008,  16:46)
Project-Options-Compiler-Optimization
 smile

да пофигу ему на это) smile

Добавлено через 3 минуты и 59 секунд
только так пошло
Код

procedure TForm1.RadioButton1Click(Sender: TObject);
var
qwer: boolean;
begin
qwer:=true;
if qwer=false then exit;
if radiobutton1.Checked=false then del_otv(labelededit2.Text);
if radiobutton1.Checked=true then
  begin
    if radiobutton2.Checked=true then
      if radiobutton3.Checked=true then
        if radiobutton4.Checked=true then
          if radiobutton5.Checked=true then
      begin
        qwer:=false;
        showmessage('âû ó âàñ âûáðàííî ìàêñèìàëüíîå êîëëè÷åñòâî ïðàâèëüíûõ îòâåòîâ.');
        radiobutton1.Checked:=false;
      end
    else  add_otv(labelededit2.Text);
  end;
//otv:=labelededit2.Text;
//redaktotv:=otv;
end;

кто знает почему он через and глючит?

Автор: Urvin 10.2.2008, 17:36
Код

procedure TForm1.RadioButton1Click(Sender: TObject);
begin

  if radiobutton1.Checked then begin
    if radiobutton2.Checked and radiobutton3.Checked and
                 radiobutton4.Checked and radiobutton5.Checked then begin
      showmessage('PREVED');
      radiobutton1.Checked:=false;
    end
    else  add_otv(labelededit2.Text);
  end else begin
    del_otv(labelededit2.Text);
  end;

end;


Превед покажется только в том случае, если все радибутоны включены

Автор: EmGard 10.2.2008, 17:42
Ты задаешь условие,что при radiobutton2,radiobutton3,radiobutton4,radiobutton5.Checked  true что то произойдет,но это условие не выполнится,если radiobutton находятся на одном компоненте вместе...


if radiobutton2.Checked=true and radiobutton3.Checked=true and radiobutton4.Checked=true and radiobutton5.Checked=true  означает" если все эти radiobutton.Checked будут true"


Код

if (radiobutton2.Checked=true) and  radiobutton3.Checked=true) and (radiobutton4.Checked=true) and (radiobutton5.Checked=true)

Автор: Ospa 10.2.2008, 17:50
угу всем спс понял) smile 

Автор: ivan219 11.2.2008, 00:01
Используй RadioGroup и Case of

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)