SRL Archive - General

Forms help.


Jagex_Fagex

2006-05-14 06:58:17

ok, i have looked at the forms tuts in tut island.. but, one thing i don't know, but have really wanted to, is how to use the drop down boxes.. if anyone can teach me, or give me the code, or anything to allow me to add options to it, please grab me on msn, or post here. thanks.

XxKanexX

2006-05-14 07:13:17

Declaring:

var
ComboBox1 : TComboBox;

Script:

ComboBox1 := TComboBox.Create(frmDesign);
ComboBox1.Parent := frmDesign;
ComboBox1.Left := 11;
ComboBox1.Top := 7;
ComboBox1.Width := 145;
ComboBox1.Height := 21;
ComboBox1.ItemHeight := 13;
ComboBox1.TabOrder := 8;
ComboBox1.Text := 'ComboBox1';

Adding an item:
In the form information:

ComboBox1.Items.Add('Text of next..');

Finding:
To find the current text:

writeln(ComboBox1.text);

Boolean'ing:

if (ComboBox1.text = 'yes') then
Writeln('True!');

EXAMPLE:

var
frmDesign : TForm;
ComboBox1 : TComboBox;

procedure Say(Sender: TObject);
begin
Writeln('Just Chose: ' + ComboBox1.Text);
end;

procedure InitForm;
begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 696;
frmDesign.Height := 480;
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 := false;
frmDesign.PixelsPerInch := 96;
ComboBox1 := TComboBox.Create(frmDesign);
ComboBox1.Parent := frmDesign;
ComboBox1.Left := 11;
ComboBox1.Top := 7;
ComboBox1.Width := 145;
ComboBox1.Height := 21;
ComboBox1.ItemHeight := 13;
ComboBox1.TabOrder := 8;
ComboBox1.Text := 'ComboBox1';
ComboBox1.Items.Add('Item1');
ComboBox1.Items.Add('Item2');
ComboBox1.Items.Add('Item3');
ComboBox1.Items.Add('Item4');

ComboBox1.OnChange:= @Say;
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.

Anymore questions, just ask ;)

Jagex_Fagex

2006-05-16 03:50:35

sweet thanks man, for helping, and also having this as "a special circumstance(sp?)"

if you are wondering what that means. you post somewhere that you would not post in rs or scar related things, except in special circumstances(sp?)

BTW, you know how to make a pic as the background, that i would really like to know.

Pyro

2006-05-16 04:22:39

From: Jagex_Fagex
sweet thanks man, for helping, and also having this as "a special circumstance(sp?)"

if you are wondering what that means. you post somewhere that you would not post in rs or scar related things, except in special circumstances(sp?)

BTW, you know how to make a pic as the background, that i would really like to know.


Ahhh no it was just runescape related things. But anyways. The best thing is to find a script where it has drop downboxes and a back ground image and learn form there. All i did to start off with mine was just copy and paste half the dropdown menu options from someone elses script then edit it to fit my needs. Then learn on from there