Results 1 to 4 of 4

Thread: How to combine this into 1 procedure

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default How to combine this into 1 procedure

    Ok, so I want to combine my Tsender procedures into 1, I know it's possible but I'm not sure how to:

    Simba Code:
    procedure Quit(Sender: TObject);
    begin
      Pressed := False;
      Writeln('Script stopped');
      DsgnForm.CLOSE;
    end;
    procedure Antimsg(Sender: TObject);
    begin
      case (CheckBoxs[0].Checked) of
        True:  writeln('ANTI BAN ON');
        False: writeln('ANTI BAN OFF');
      end;
    end;
    procedure progressmsg(Sender: TObject);
    begin
      case (CheckBoxs[1].Checked) of
        True:  writeln('PAINT ON');
        False: writeln('PAINT OFF');
      end;
    end;
    procedure bankmsg(Sender: TObject);
    begin
      case (CheckBoxs[2].Checked) of
        True:  writeln('BANK HIGHLIGHTING ON');
        False: writeln('BANK HIGHLIGHTING OFF');
      end;
    end;
    procedure modmsg(Sender: TObject);
    begin
      case (CheckBoxs[2].Checked) of
        True:  writeln('LOGOUT ON MOD ON');
        False: writeln('LOGOUT ON MOD OFF');
      end;
    end;

    That just seems repetitive

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    procedure foo(sender: TObject);
    begin
    case sender of
    checkBoxs[0]:
    begin
    end;

    checkBoxs[1]:
    begin
    end;
    end;
    end;

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    EDIT: Ninja'd

    Simba Code:
    var
      frmMain: TForm;
      Params: TVariantArray;

    procedure OnClick(Sender: TObject);
    begin
      if (Sender = frmMain) then  //Check who the sender is to determine what to do..
        writeln('MEh');
    end;

    procedure InitialiseForm;
    begin
      frmMain := TForm.Create(nil);
      frmMain.OnClick := @OnTick;
      frmMain.ShowModal;
    end;

    begin
      ThreadSafeCall('InitialiseForm', Params);

      frmMain.Close;
      frmMain.Free;
    end.
    I am Ggzz..
    Hackintosher

  4. #4
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    thanks for the help guys i got it:

    Simba Code:
    Procedure ObjectHit(Sender: TObject);
    begin
      case sender of
        CheckBoxs[0]:
        begin
          case (CheckBoxs[0].Checked) of
            True:  writeln('ANTI BAN ON');
            False: writeln('ANTI BAN OFF');
          end;
        end;
        CheckBoxs[1]:
        begin
          case (CheckBoxs[1].Checked) of
            True:  writeln('PAINT ON');
            False: writeln('PAINT OFF');
          end;
        end;
        CheckBoxs[2]:
        begin
          case (CheckBoxs[2].Checked) of
            True:  writeln('BANK HIGHLIGHTING ON');
            False: writeln('BANK HIGHLIGHTING OFF');
          end;
        end;
        CheckBoxs[3]:
        begin
          case (CheckBoxs[3].Checked) of
            True:  writeln('LOGOUT ON MOD ON');
            False: writeln('LOGOUT ON MOD OFF');
          end;
        end;
      end;
    end;

    Not done yet though

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •