mr. pali
2006-04-06 00:11:20
I WILL FINISH THIS TOMORROW! Too tired and still have home-work. Make comments on how I'm doing so far.
This is a tutorial on how to use Forms in SCAR, and make them good and useful!
Forms can look like these: (Autofighter made by me and realrune in the old days of kaitnieks)

-First off, what is a form?
Well, your internet browser is a type of Form, so is Microsft Word
Most forms we use in XP are written in a program called Visual Basic. Visual Basic is a program that makes complex forms, SCAR can make "simple" ones.
-Have I seen forms in SCAR before?
Most likely. You can recognize a form as somthing that pops up when you start a script in SCAR. Forms are a way to get input from users easier.
An important thing to know in scar is that with forms, the script is paused. So no, the script can not be executing whilst a form is open.
Now that we've got the basic idea of what a form is, we can learn to make some.
Now with forms, there are four major procedures
InitForm : This holds the data for the form to display.
SafeInitForm : Safely calls the form
ShowFormModal : Shows the form
SafeShowFormModal: Shows the form safely
With all of these procedures in your script, you can properly show a form.
Now, how to create a form using the form editor
The form editor can be accessed by going into scar, on the top bar:
Tools –> Form editor
This is what the form editor looks like:
The panel named form design is where you build your form. It is your canvas. The top bar named Form Designer is where you pick objects to put onto your Form Design. And the object inspector is where you change the object on the form design. Its how you make buttons say different things on them, and make your form a different color.
Now, we create a form! Drag a button (The icon with the [ ok ] on it) onto your Form Design. Save this and exit out of the form editor windows.
Now it's time to enter those procedures.
Put these four procedures into your script:
And put this as your main loop:
Once we have this, we can continue.
Now go back in to the main SCAR window, click:
Tools –> Load DFM Form
Open the form you saved.
-I'll keep going just wanna see how it looks so far-
This is a tutorial on how to use Forms in SCAR, and make them good and useful!
Forms can look like these: (Autofighter made by me and realrune in the old days of kaitnieks)

-First off, what is a form?
Well, your internet browser is a type of Form, so is Microsft Word
Most forms we use in XP are written in a program called Visual Basic. Visual Basic is a program that makes complex forms, SCAR can make "simple" ones.
-Have I seen forms in SCAR before?
Most likely. You can recognize a form as somthing that pops up when you start a script in SCAR. Forms are a way to get input from users easier.
An important thing to know in scar is that with forms, the script is paused. So no, the script can not be executing whilst a form is open.
Now that we've got the basic idea of what a form is, we can learn to make some.
Now with forms, there are four major procedures
InitForm : This holds the data for the form to display.
SafeInitForm : Safely calls the form
ShowFormModal : Shows the form
SafeShowFormModal: Shows the form safely
With all of these procedures in your script, you can properly show a form.
Now, how to create a form using the form editor
The form editor can be accessed by going into scar, on the top bar:
Tools –> Form editor
This is what the form editor looks like:
The panel named form design is where you build your form. It is your canvas. The top bar named Form Designer is where you pick objects to put onto your Form Design. And the object inspector is where you change the object on the form design. Its how you make buttons say different things on them, and make your form a different color.Now, we create a form! Drag a button (The icon with the [ ok ] on it) onto your Form Design. Save this and exit out of the form editor windows.
Now it's time to enter those procedures.
Put these four procedures into your script:
//Procedure 1:
procedure InitForm;
begin;
end;
//Procedure 2:
procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;
//Procedure 3:
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;
//Procedure 4:
procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;
And put this as your main loop:
begin
SafeInitForm;
SafeShowFormModal;
end.Once we have this, we can continue.
Now go back in to the main SCAR window, click:
Tools –> Load DFM Form
Open the form you saved.
-I'll keep going just wanna see how it looks so far-