Page 1 of 2 12 LastLast
Results 1 to 25 of 30

Thread: Complete forms tutorial

  1. #1
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Complete forms tutorial

    If you read this tutorial, please reply! It only takes 5 seconds.

    Welcome to my forms tutorial. What is a form? A form is basically a user-friendly interface where anyone can setup your script.
    This tutorial will be divided in 4 different chapters.

    Table of Contents

    Chapter 1 - Creating the form
    Chapter 2 - Using the form in your scripts
    Chapter 3 - Making the forms do other things UNDER CONSTRUCTION
    Chapter 4 - Making the forms look good UNDER CONSTRUCTION

    Chapter 1 - Creating the form

    Overview
    In this chapter, we will be learning how to use the form editor, and also how to create a basic form. The form that we will be creating will save a username and a password. You will learn: Labels, Buttons, Edit boxes, and general form stuff.

    Getting started
    Now lets open the form editor shall we? In SCAR, go to Tools > Form Editor. 3 different menus/boxes should appear. Lets get started with the first and easiest step. Creating the labels.



    Labels
    Click on the A that is in the red circle:

    Now click anywhere in the biggest box, that is named "frmDesign". Some text should show up, it should say "Label1". Now shift your interest to the box that we havn't examined yet, the long and skinny one. This next picture should explain everything.

    *Note: In order for the options to change, after you edit one of the options, you must then click somewhere in the "Object Inspector".
    Those are the most important things that you should know. If you want, you can fiddle around with other settings. If you want to move the label, just click on it and drag it anywhere you want. If you want to change the size of the form, click on a corner of "frmDesign" and make the size whatever you want.

    Create another Label called "Password". Your form should look something like this:




    Edit Boxes
    Now that we have created some labels, we need edit boxes so that the user will be able to input something. Click on the box to the right of the Label one and make a click next to the Username and Password box.

    You can change the Text to whatever you want, or you can remove it completely. Change the Name to "UserEdit" for the box next to the Username label, and "PassEdit" next to the Password label. Scroll down, and change the width of the boxes if you want. It will look better, but remember not to make them to small! I made mine 70pixels in width. You can also change the "Hints". Whatever you put into the "Hint" box, will show up if the user moves his crusor over the Edit box. My hints say "Username here" and "Password here".

    Your form should look like this:




    Buttons
    Yay Buttons! Exciting. Lets make a start button shall we? Find the box with "ok" written in it, in the Form Designer box.

    Once again, change the Caption to Start, and change the Name to StartButton. If you want, you can change the height and the width to, will look sexy. I changed the height to 20, and the width to 50. My form looks like this:



    Form Stuff
    Now click click anywhere on the form(except the buttons, edit boxes or labels) and change the caption to what you want. I changed mine to "Username and Password". You can fiddle around with the options, and change the color if you want, but I didn't. Finished product should look like this:



    Save the form by clicking the Save icon.


    Chapter 2 - Using the form in your script

    Overview
    In this chapter, we will be learning how to put the form that we have made into your script. You will learn: form procedures, form setup.



    Getting started
    Lets convert the form that we have just made to text. In SCAR, do to Tools > Load DFM Form. Open the form that you just saved. In the debug box, you should see alot of text. Put everything under "//Add these objects to variable declarations" into your vars section of the script.
    SCAR Code:
    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;
    Create a procedure named "InitForm" and put everything under "///////////////// Generated from: FORM-NAME.dfm" into the procedure. You should have:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := True;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    end;

    begin

    end.

    Now we will add 3 more procedures. They are needed to make sure that the form works properly:
    SCAR Code:
    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    Add these lines to the main loop.
    SCAR Code:
    SafeInitForm;
      SafeShowFormModal;
    and change this in the InitForm procedure
    SCAR Code:
    frmDesign.Visible := True;
    to
    SCAR Code:
    frmDesign.Visible := False;

    They will make the form show up.




    Making the form do something
    You should have this code:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
    end.
    Now before you run the script, lets make the start button do something, shall we? Find
    SCAR Code:
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;

    and add
    SCAR Code:
    StartButton.OnClick := @StartClick;
    somewhere in there.
    What that does, is calls out the procedure called "StartClick" when you click the start button. Lets make that procedure shall we? Above the procedure "InitForm", create the procedure named "StartClick"
    SCAR Code:
    procedure StartClick(sender: TObject);
    begin
      Writeln('Hello world');
      frmDesign.ModalResult:= mrOk; // Closes the form
    end;

    Your script should now look something like this:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;

    procedure StartClick(sender: TObject);
    begin
      Writeln('Hello world');
      frmDesign.ModalResult:= mrOk; // Closes the form
    end;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.OnClick := @StartClick;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
    end.
    Now lets make sure that the Username and Password boxes actually do something. Add
    SCAR Code:
    Username, Password : String;
    to the var section. Next, we will insert this code into the "StartClick" procedure.
    SCAR Code:
    Username := UserEdit.Text;
      Password := PassEdit.Text;
    What this will do is save whatever is in the Edit boxes named "UserEdit" and "PassEdit" as into the strings named Username and Password.
    If you want to text this out, add
    SCAR Code:
    WriteLn('Username = ' + Username);
      Writeln('Password = ' + Password);
    to the "StartClick" procedure under the Username and Password lines.

    Woot. You have just created a form My final script looks like this:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;
      Username, Password : String;

    procedure StartClick(sender: TObject);
    begin
      Writeln('Hello world');
      Username := UserEdit.Text;
      Password := PassEdit.Text;
      WriteLn('Username = ' + Username);
      Writeln('Password = ' + Password);
      frmDesign.ModalResult:= mrOk; // Closes the form
    end;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.OnClick := @StartClick;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
    end.




    Chapter 3 - Making the forms do other things

    Overview
    In this chapter, we will be learning more advanced stuff about your form. You will learn: combo boxes, check boxes, implementing them into your script, and saving form settings to a file.



    Getting started
    First of all, we need to open the form editor and then open the form we created in Chapter 1. Shift your attention to the "Form Designer again" Click on the red circle.




    Combo box
    Now, lets create a Combo box, shall we? Click on the combo box icon then click an empty place under the Password label. You may change the Text and width settings to your liking. My text now says "Tim FTW?", my name is "FTWCombo". My form now looks like this.

    Now lets add options. Find where it says "Items" and in the column next to it "(Tstrings)".

    Click there, and a new box should show up. I added two lines in that box, True and False.

    When your done, click OK. Save your form.



    Implementing the combo box into your script
    As we did before, load the form by doing to Tools > Load DFM form. Once again post the variables that show up in the variables section of your script(don't forget to add Username and Password to var's as a string!), and the rest into a procedure called InitForm. Also, add the StartClick procedure that we made earlier, and add
    SCAR Code:
    StartButton.OnClick := @StartClick;
    to the Button section of the form. Then change
    SCAR Code:
    frmDesign.Visible := True;
    to
    SCAR Code:
    frmDesign.Visible := False;
    and add the rest of the needed form procedures. You should now have a script that looks something like this:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;
      FTWCombo : TComboBox;
      Username, Password : String;

    procedure StartClick(sender: TObject);
    begin
      Writeln('Hello world');
      Username := UserEdit.Text;
      Password := PassEdit.Text;
      WriteLn('Username = ' + Username);
      Writeln('Password = ' + Password);
      frmDesign.ModalResult:= mrOk; // Closes the form
    end;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.OnClick := @StartClick;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    FTWCombo := TComboBox.Create(frmDesign);
    FTWCombo.Parent := frmDesign;
    FTWCombo.Left := 69;
    FTWCombo.Top := 123;
    FTWCombo.Width := 145;
    FTWCombot.Height := 21;
    FTWCombo.ItemHeight := 13;
    FTWCombo.TabOrder := 11;
    FTWCombo.Text := 'Tim FTW?';
    FTWCombo.Items.Add('True');
    FTWCombo.Items.Add('False');
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
    end.

    Now lets edit the StartClick procedure some more so that the Combo box actually does something. Lets add a variable called "Ftw". Make it a Boolean variable. Now in the StartClick procedure, add this line:
    SCAR Code:
    Ftw:=StrToBool(FtwCombo.text);
    What this does is declare the Ftw var either true or false, depending on what the user picked. StrToBool changes the string which is in FtwCombo to a Boolean. Now, to make sure that this works, add this line to the main loop
    SCAR Code:
    if(Ftw) then
    WriteLn('Booya, combo boxes rule(so does Tim)')
    else
    WriteLn('False?! I RULE');
    Finished product:
    SCAR Code:
    program new;

    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      UserEdit : TEdit;
      PassEdit : TEdit;
      StartButton : TButton;
      FTWCombo : TComboBox;
      Username, Password : String;
      Ftw : Boolean;

    procedure StartClick(sender: TObject);
    begin
      Writeln('Hello world');
      Username := UserEdit.Text;
      Password := PassEdit.Text;
      Ftw:=StrToBool(FtwCombo.text);
      WriteLn('Username = ' + Username);
      Writeln('Password = ' + Password);
      frmDesign.ModalResult:= mrOk; // Closes the form
    end;

    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 275;
    frmDesign.Top := 122;
    frmDesign.Width := 350;
    frmDesign.Height := 243;
    frmDesign.Caption := 'Username and Password';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := False;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 53;
    Label1.Top := 71;
    Label1.Width := 48;
    Label1.Height := 13;
    Label1.Caption := 'Username';
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 53;
    Label2.Top := 92;
    Label2.Width := 46;
    Label2.Height := 13;
    Label2.Caption := 'Password';
    UserEdit := TEdit.Create(frmDesign);
    UserEdit.Parent := frmDesign;
    UserEdit.Left := 113;
    UserEdit.Top := 68;
    UserEdit.Width := 70;
    UserEdit.Height := 21;
    UserEdit.Hint := 'Username here';
    UserEdit.ParentShowHint := False;
    UserEdit.ShowHint := True;
    UserEdit.TabOrder := 8;
    PassEdit := TEdit.Create(frmDesign);
    PassEdit.Parent := frmDesign;
    PassEdit.Left := 113;
    PassEdit.Top := 93;
    PassEdit.Width := 70;
    PassEdit.Height := 21;
    PassEdit.Hint := 'Password here';
    PassEdit.ParentShowHint := False;
    PassEdit.ShowHint := True;
    PassEdit.TabOrder := 9;
    StartButton := TButton.Create(frmDesign);
    StartButton.Parent := frmDesign;
    StartButton.OnClick := @StartClick;
    StartButton.Left := 112;
    StartButton.Top := 155;
    StartButton.Width := 50;
    StartButton.Height := 20;
    StartButton.Caption := 'Start';
    StartButton.TabOrder := 10;
    FTWCombo := TComboBox.Create(frmDesign);
    FTWCombo.Parent := frmDesign;
    FTWCombo.Left := 69;
    FTWCombo.Top := 123;
    FTWCombo.Width := 145;
    FTWCombo.Height := 21;
    FTWCombo.ItemHeight := 13;
    FTWCombo.TabOrder := 11;
    FTWCombo.Text := 'Tim FTW?';
    FTWCombo.Items.Add('True');
    FTWCombo.Items.Add('False');
    end;

    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    begin
      SafeInitForm;
      SafeShowFormModal;
      if(Ftw) then
       WriteLn('Booya, combo boxes rule(so does Tim)')
      else
       WriteLn('False?! I RULE');
    end.


    Chapter 4 - Making the forms look good

    Overview
    In this chapter, we will be learning how to make your form look nice and sexy(). You will learn: adding colors and images.



    Getting started
    Well, lets start with images. Open up a form, or make one.
    UNDER CONSTRUCTION


    Background Colors
    Click the actual form, and look at the Object Inspector.

    The picture basically tells you everything.


    Other Tutorials
    Here are some tutorials that other members of the forum have made about forums. They are very useful.

    Form during script runtime
    Forms with a scroll bar
    Click here to learn how to make forms with Menus.
    If you want to learn how to make borderless and forms without a title bar click here.

    This is currently all I have done. Feedback appreciated!
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  2. #2
    Join Date
    Feb 2007
    Location
    Alberta, Canada
    Posts
    4,615
    Mentioned
    50 Post(s)
    Quoted
    429 Post(s)

    Default

    looks good, but do i have to use an array to make multiple players with a form?

    Scripts: Edgeville Chop & Bank, GE Merchanting Aid
    Tutorials: How to Dominate the Grand Exchange

    Quote Originally Posted by YoHoJo View Post
    I like hentai.

  3. #3
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Look at Users.scar. You can pretty much use those procedures. You use the array that is already created for SRL Multi-player.
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  4. #4
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    nice tut...but instead of
    Look at Users.scar. You can pretty much use those procedures. You use the array that is already created for SRL Multi-player.
    ...u might want to put it in your tut
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  5. #5
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It's pretty advanced stuff...much easier to copy and paste into your script, changing all the names of the boxes...
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

  6. #6
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by 3garrett3 View Post
    looks good, but do i have to use an array to make multiple players with a form?
    Look in Users.Scar.

    Or you can always just call:

    StartPlayers(true, ''); "p

    Nice tut, tim.

  7. #7
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for your replies guys Hopefully I'll finish the tut by Tuesday...
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  8. #8
    Join Date
    Mar 2007
    Location
    Under a rock
    Posts
    813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Good form tut, shows the basics of how to get a form working. I personally learn most of my stuff from justs going into the Scar 3.06/Scripts/Test folder lol. Good tut though, nice and simple.

  9. #9
    Join Date
    Feb 2006
    Location
    Helsinki, Finland
    Posts
    1,395
    Mentioned
    30 Post(s)
    Quoted
    107 Post(s)

    Default

    Very nice tutorial Tim!

  10. #10
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for replying! I hate it when people read a tutorial and don't post

    @Rune Hacker, don't worry, there will be a learning experience for everyone I will be adding more advanced stuff today.
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  11. #11
    Join Date
    Mar 2007
    Posts
    3,681
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    how can i make my form stay up during the script running?

  12. #12
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    http://www.villavu.com/forum/showthread.php?t=5427

    Hmm, I don't know if I will finish this tut or not =\
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  13. #13
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Wow awesome guide!, Thank you so much!.

    All other guides dont have pictures and everything but yours does

    20/10

  14. #14
    Join Date
    Jun 2007
    Location
    Varrock East bank,
    Posts
    87
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey man, that was really helpful, thanks very much (y)

    - Shadows-collide -

  15. #15
    Join Date
    May 2007
    Location
    Canada
    Posts
    261
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    No problem guys, glad to help
    On vacation from July 2nd till middle of August


    Account Creator and Tutorial Island Runner (member | public) Errors fixed


    Check out my Complete forms tutorial. It will teach you everything you need to know about forms.

  16. #16
    Join Date
    Jun 2007
    Posts
    124
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by SantaClause View Post
    It's pretty advanced stuff...much easier to copy and paste into your script, changing all the names of the boxes...
    Ya i agree, but atleast now i have a basic understanding...ty tim

  17. #17
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    Nice Tutorial

  18. #18
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice tut. BTW: What skin is that? Me likey

  19. #19
    Join Date
    Oct 2006
    Posts
    1,071
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Thanks for this tut Only one that's been able to get me to understand forms

  20. #20
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hey, thanks for the tut.. really helped me make my forms!

  21. #21
    Join Date
    Jul 2007
    Posts
    1,431
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ffs, i missed your guide!
    i was searching for guide like that over a hour... well theres lotsa form tuts
    but no1 didnt explained how to use form editor!
    thank you!
    [CENTER][SIZE="4"]Inactive[/SIZE]I forgot my password[/CENTER]

  22. #22
    Join Date
    Aug 2007
    Posts
    9
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default strtobool

    very nice tutorial, but... when i use it in a script it says 'unknown identifier strtobool in script'

    ive attached my script to the post.Attachment 6331

  23. #23
    Join Date
    Aug 2007
    Location
    Emo-land
    Posts
    1,109
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Very nice tut, helped alot, thanks. Have a good holiday and hope ya get ur 4 bux

    Edit: StrToBool is a built in SCAR function, it works. Try re installing SCAR.

  24. #24
    Join Date
    Nov 2007
    Posts
    14
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice tutorial
    This is helping me learn how to script!

  25. #25
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Don't grave dig...

    Sorry hy, ur gone so here it is

    12-20-2007, 01:24 AM

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Complete DDTM Walking Tutorial.
    By BobboHobbo in forum OSR Intermediate Scripting Tutorials
    Replies: 43
    Last Post: 05-02-2013, 11:25 AM
  2. Complete Form Tutorial
    By BobboHobbo in forum OSR Advanced Scripting Tutorials
    Replies: 10
    Last Post: 05-29-2012, 01:36 PM
  3. Solarwind's Tutorial Island Runner. (First complete alpha).
    By solarwind in forum RS3 Outdated / Broken Scripts
    Replies: 61
    Last Post: 09-18-2008, 07:35 AM

Posting Permissions

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