Results 1 to 11 of 11

Thread: Complete Form Tutorial

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

    Default Complete Form Tutorial

    Form - How to make a form Basic to Advance.

    Chapter 1: Creating a basic form.

    *Under Construction*

    Chapter 1: Creating a basic form.
    Starting off, open up scar and go to tools > Form Editor. Now a Grayed dotted box should show up, by the conner of the dotted grayed box make it to the size you want the form to be.On the side of the grayed box you have a menu panel on the top. Example bellow:

    Now you can see the Top menu bar has pictures showing what it makes. Example the button button. Click it from the top Menu.



    Click that button picture and then click somewhere on the grayed dotted box thing. A button will show up you can move it all around and do what you want with it with sizes names etc. How to change the Caption of the Button? well click on the button and on on the right a box should have a bunch of writing in it.



    On here you can do everything you want with the button, if you want to change what shows up on the button click on the Caption Option which is highlighted on the picture above. This controlls what is written on the button. BUT before you change the name of the Caption change the name of the button itself, so you can easily identify it in your script. Where it says Name Button1 on the right panel thing thats where you put the name of the button, change to StartButton.

    Now make 2 Edit boxes using:

    Then the top one as TopBox and the lower edit box BottomBox.
    Should look something like this:

    Now Click the Save button located on the top Menu bar. Save it in a spot where you will find.

    Now, the coding part. Go to Tools > Load DFM Form. Now find where you saved your form, and when you did that look in your debug box.

    SCAR Code:
    frmDesign := CreateForm;
    frmDesign.Left := 250;
    frmDesign.Top := 114;
    frmDesign.Width := 181;
    frmDesign.Height := 201;
    frmDesign.Caption := 'frmDesign';
    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;
    Button1 := TButton.Create(frmDesign);
    Button1.Parent := frmDesign;
    Button1.Left := 40;
    Button1.Top := 96;
    Button1.Width := 75;
    Button1.Height := 25;
    Button1.Caption := 'Button1';
    Button1.TabOrder := 8;
    Edit1 := TEdit.Create(frmDesign);
    Edit1.Parent := frmDesign;
    Edit1.Left := 24;
    Edit1.Top := 40;
    Edit1.Width := 121;
    Edit1.Height := 21;
    Edit1.TabOrder := 9;
    Edit1.Text := 'Edit1';
    Edit2 := TEdit.Create(frmDesign);
    Edit2.Parent := frmDesign;
    Edit2.Left := 24;
    Edit2.Top := 64;
    Edit2.Width := 121;
    Edit2.Height := 21;
    Edit2.TabOrder := 10;
    Edit2.Text := 'Edit2';


    //Add these objects to variable declarations
    var
      frmDesign : TForm;
      Button1 : TButton;
      Edit1 : TEdit;
      Edit2 : TEdit;

    You will see something like this. Now we need to make it work proper, so put the Vars at the top of the script and put the form stuff in a procedure, ill shoe bellow.

    SCAR Code:
    var
      frmDesign : TForm;
      Button1 : TButton;
      Edit1 : TEdit;
      Edit2 : TEdit;
    procedure FormStuff;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 250;
    frmDesign.Top := 114;
    frmDesign.Width := 181;
    frmDesign.Height := 201;
    frmDesign.Caption := 'frmDesign';
    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;
    Button1 := TButton.Create(frmDesign);
    Button1.Parent := frmDesign;
    Button1.Left := 40;
    Button1.Top := 96;
    Button1.Width := 75;
    Button1.Height := 25;
    Button1.Caption := 'Button1';
    Button1.TabOrder := 8;
    Edit1 := TEdit.Create(frmDesign);
    Edit1.Parent := frmDesign;
    Edit1.Left := 24;
    Edit1.Top := 40;
    Edit1.Width := 121;
    Edit1.Height := 21;
    Edit1.TabOrder := 9;
    Edit1.Text := 'Edit1';
    Edit2 := TEdit.Create(frmDesign);
    Edit2.Parent := frmDesign;
    Edit2.Left := 24;
    Edit2.Top := 64;
    Edit2.Width := 121;
    Edit2.Height := 21;
    Edit2.TabOrder := 10;
    Edit2.Text := 'Edit2';
    end;

    Now we need to add the main parts of a form:
    SCAR Code:
    procedure ShowForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('FormStuff', v);
    end;

    SCAR Code:
    procedure ShowformModal;
    begin
      frmDesign.ShowModal;
    end;

    SCAR Code:
    procedure SafeShowModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowformModal', v);
    end;
    You need all these 3 procedures to make a form to show up THEY are verry important!! Like: (look down into the scar code)
    SCAR Code:
    program Form;
    var
      frmDesign : TForm;
      Button1 : TButton;
      Edit1 : TEdit;
      Edit2 : TEdit;
    procedure FormStuff;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 250;
    frmDesign.Top := 114;
    frmDesign.Width := 181;
    frmDesign.Height := 201;
    frmDesign.Caption := 'frmDesign';
    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;
    Button1 := TButton.Create(frmDesign);
    Button1.Parent := frmDesign;
    Button1.Left := 40;
    Button1.Top := 96;
    Button1.Width := 75;
    Button1.Height := 25;
    Button1.Caption := 'Button1';
    Button1.TabOrder := 8;
    Edit1 := TEdit.Create(frmDesign);
    Edit1.Parent := frmDesign;
    Edit1.Left := 24;
    Edit1.Top := 40;
    Edit1.Width := 121;
    Edit1.Height := 21;
    Edit1.TabOrder := 9;
    Edit1.Text := 'Edit1';
    Edit2 := TEdit.Create(frmDesign);
    Edit2.Parent := frmDesign;
    Edit2.Left := 24;
    Edit2.Top := 64;
    Edit2.Width := 121;
    Edit2.Height := 21;
    Edit2.TabOrder := 10;
    Edit2.Text := 'Edit2';
    end;

    procedure ShowForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('FormStuff', v);
    end;
    procedure ShowformModal;
    begin
      frmDesign.ShowModal;
    end;
    procedure SafeShowModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowformModal', v);
    end;
    Begin
      ShowForm;
      SafeShowModal;
    end.

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

    Default

    Reseerved* not good at making tuts

    Soo tired ill do more tomoz.

  3. #3
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    leaving the srl-community, but writing a tut?...lol cant make up the mind huh? looks like a good tut, will definitely will be making a form for my next script

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


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

    Default

    You better add tabs
    [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]

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

    Default

    Quote Originally Posted by HyperSecret View Post
    leaving the srl-community, but writing a tut?...lol cant make up the mind huh? looks like a good tut, will definitely will be making a form for my next script
    I wrote before i left but back ina day how weird

    Quote Originally Posted by Santa_Clause View Post
    You better add tabs
    I sure will!

  6. #6
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    going good, but i want more how do i add many choices to a list? tabs? sned to back and send to front, group boxes, scroll bars?!

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  7. #7
    Join Date
    Nov 2009
    Posts
    471
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Error:
    [Runtime Error] : Exception: Cannot make a visible window modal in line 64 in script
    Failed when compiling

  8. #8
    Join Date
    Aug 2008
    Location
    Finland
    Posts
    2,851
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

  9. #9
    Join Date
    Oct 2011
    Location
    UK
    Posts
    1,322
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Sir R. M8gic1an View Post
    going good, but i want more how do i add many choices to a list? tabs? sned to back and send to front, group boxes, scroll bars?!

    ~RM
    I know this is from 2008, but yes, how do you do scroll bars?

  10. #10
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    TScrollBar
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  11. #11
    Join Date
    May 2012
    Location
    VARROCK
    Posts
    47
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Seems not bad.

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 forms tutorial
    By tim46 in forum OSR Advanced Scripting Tutorials
    Replies: 29
    Last Post: 06-12-2009, 11:43 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
  •