SRL Archive - OSR Advanced Scripting Tutorials

Complete forms tutorial


tim46

2007-06-17 17:18:27

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.
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:
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:
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.
  SafeInitForm;
SafeShowFormModal;
and change this in the InitForm procedure
frmDesign.Visible := True;
to
frmDesign.Visible := False;

They will make the form show up.




Making the form do something
You should have this 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
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
 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"
procedure StartClick(sender: TObject);
begin
Writeln('Hello world');
frmDesign.ModalResult:= mrOk; // Closes the form
end;

Your script should now look something like this:
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
Username, Password : String;
to the var section. Next, we will insert this code into the "StartClick" procedure.
  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
  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:
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
StartButton.OnClick := @StartClick;
to the Button section of the form. Then change
 frmDesign.Visible := True;
to
 frmDesign.Visible := False;
and add the rest of the needed form procedures. You should now have a script that looks something like this:
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:
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
 
if(Ftw) then
WriteLn('Booya, combo boxes rule(so does Tim)')
else
WriteLn('False?! I RULE');
Finished product:
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(:p). 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!

3Garrett3

2007-06-17 17:28:50

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

tim46

2007-06-17 17:39:06

Look at Users.scar. You can pretty much use those procedures. You use the array that is already created for SRL Multi-player.

Dan Cardin

2007-06-17 18:55:02

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

Santa_Clause

2007-06-17 19:05:03

It's pretty advanced stuff…much easier to copy and paste into your script, changing all the names of the boxes…

WhiteShadow

2007-06-17 20:21:20

From: 3garrett3
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. :)

tim46

2007-06-17 20:58:30

Thanks for your replies guys :) Hopefully I'll finish the tut by Tuesday…

Rune Hacker

2007-06-18 01:23:37

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.

Janilabo

2007-06-18 03:42:50

Very nice tutorial Tim! :D

tim46

2007-06-18 07:41:48

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

@Rune Hacker, don't worry, there will be a learning experience for everyone :p I will be adding more advanced stuff today.

Hugolord

2007-06-18 14:39:18

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

tim46

2007-06-22 07:33:18

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

Hmm, I don't know if I will finish this tut or not =\

BobboHobbo

2007-06-23 07:43:59

Wow awesome guide!, Thank you so much!.

All other guides dont have pictures and everything but yours does

20/10 :D

shadows-collide

2007-06-23 09:59:44

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

- Shadows-collide -

tim46

2007-06-23 13:30:41

No problem guys, glad to help :p

dialeyj2

2007-06-27 11:49:43

From: SantaClause
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

cathering_

2007-07-28 12:03:57

Nice Tutorial

itSchRis917

2007-07-28 16:05:17

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

Tim0suprem0

2007-08-11 10:57:56

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

dvdcrayola

2007-08-14 23:09:00

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

Negaal

2007-08-31 07:42:50

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!

pontoe

2007-09-01 04:54:29

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.[ATTACH]6331[/ATTACH]

FrÕzÑ_§ÕµL

2007-12-20 04:24:01

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

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

d_sign

2008-03-29 09:34:30

Nice tutorial :)
This is helping me learn how to script!

Da 0wner

2008-03-29 18:23:46

Don't grave dig… :sasmokin:

Sorry hy, ur gone so here it is

12-20-2007, 01:24 AM

P1nky

2008-03-29 18:25:50

THANKS FOR THE GRAVE DIG! i never saw this tut and this the only 1 that is COMPLETED SWWWWWWWWEEEEEEEEEEETTTTTTTT

tarlcabot1

2008-07-12 01:17:56

Vary Nice THANKS!!! Ive been looking for a useful tut on forms
Thanks Again

shaman

2008-12-20 07:12:18

AWWWWWESOME!!!!!!!!! Now i have a simple but useful form at the start of my script and the knowledge to extended it. Thanks tim

r3dis

2008-12-26 12:49:40

really nice thanks for ur time

osmm

2009-06-12 19:43:56

yeah yeah yeah… I know this is gravdigging. BUT this tutorial still works and was very helpful. Bumping it up couldn't hurt. Maybe others will now see this thread and use it.

Thanks!