Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.86 KB | None | 0 0
  1. procedure TComponentManager.ButtonClearClick;
  2. var
  3.   I: Integer;
  4. begin
  5.   for I := 0 to (((Sender as TButton).Parent) as TForm).ComponentCount - 1 do
  6.     if (((Sender as TButton).Parent) as TForm).Components[I] is TCheckBox then
  7.   ((((Sender as TButton).Parent) as TForm).Components[I] as TCheckBox)
  8.       .Checked := False;
  9. end;
  10.  
  11. procedure TComponentManager.ButtonVoteClick;
  12. var
  13.   I, CheckedCount: Integer;
  14. begin
  15.   CheckedCount := 0;
  16.   for I := 0 to (((Sender as TButton).Parent) as TForm).ComponentCount - 1 do
  17.     if ((((Sender as TButton).Parent) as TForm).Components[I] is TCheckBox) and
  18.       (((((Sender as TButton).Parent) as TForm).Components[I] as TCheckBox)
  19.         .Checked = True) then
  20.       CheckedCount := CheckedCount + 1;
  21.  
  22.   if (CheckedCount < 4) then
  23.   begin
  24.     for I := 0 to (((Sender as TButton).Parent) as TForm).ComponentCount - 1 do
  25.       if ((((Sender as TButton).Parent) as TForm).Components[I] is TCheckBox)
  26.         and (((((Sender as TButton).Parent) as TForm)
  27.             .Components[I] as TCheckBox).Checked = True) then
  28.       begin
  29.         Ini.WriteInteger('COUNTERS', IntToStr(I + 1),
  30.           Ini.ReadInteger('COUNTERS', IntToStr(I + 1), 0) + 1);
  31. ((((Sender as TButton).Parent) as TForm).Components[I] as TCheckBox)
  32.         .Checked := False;
  33.       end;
  34.     Ini.WriteInteger('COUNTERS', 'Total', Ini.ReadInteger('COUNTERS', 'Total',
  35.         0) + CheckedCount);
  36.   end
  37.   else
  38.   begin
  39.     for I := 0 to (((Sender as TButton).Parent) as TForm).ComponentCount - 1 do
  40.       if (((Sender as TButton).Parent) as TForm).Components[I]
  41.         is TCheckBox then ((((Sender as TButton).Parent) as TForm)
  42.             .Components[I] as TCheckBox)
  43.         .Checked := False;
  44.  
  45.     Ini.WriteInteger('COUNTERS', 'Invalid', Ini.ReadInteger('COUNTERS',
  46.         'Invalid', 0) + 1);
  47.   end; (((Sender as TButton).Parent) as TForm)
  48.   .Close();
  49. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement