SRL Archive - Senior News and General

SRLPlayerForm update


Sumilion

2008-01-09 11:52:00

Hey all,

I want to update the SRLPlayerForm so that you can also add a variable ComboBox. It will in the end save the setting in Players[x].Strings[y] but I'm not so sure on how I should do the parameters …

One way I thought of was to use a TStringArray and that [0] of that array is the name of the combobox, [1] is the default setting and the rest are the options …

I also thought of an array of TStringArray; But then you would have to create a variable for that before calling the SRLPlayerForm function so in the end I don't think it will be much better than just a TStringArray, but if you think otherwise let me know.

But I was wondering if anyone might have a better solution … or any tips or things you would like to see in the PlayerForm while im at it ..

EDIT: I also thought about making the boolean vars buttons instead of comboboxes. One of the buttons will be disabled, for example False, then when you click on True, it will get disabled… Do you think it is better or should I leave it at comboboxes ?

Markus

2008-01-09 12:37:51

About the booleans, make them checkboxes ;)
Array of TStringArray, hmm, imo that's the way to go. First array (x) is players.strings[x], and y is the value. If empty, an editbox would be displayed, else a combobox. I'd really like to see that. Maybe another array of string for the names of the edit/comboboxes then.

SKy Scripter

2008-01-09 13:25:45

By All Means Dont add More variables to that XD, jk…

I Guess That would probably be the way i would go…

Array of Array of String;

Sumilion

2008-01-09 17:12:51

Checkboxes for booleans =S IMO that's so ugly because the boxes are so small :p

The downside of having an array of TStringArray is that you can't call the SRLPlayerForm in one line …

You would have to do :

SettingsList[0] := ['SettingName', 'Option1', 'Option2', 'Etc'];
SettingsList[1] := ['SettingName2', 'Option1', 'Option2', 'Etc'];
SRLPlayerForm(True, [], [], [], [], [SettingsList[0], SettingsList[1]]);

At least if I am not mistaking … please do correct me if I'm wrong but this is as how I remembered it.

Would that bother you ? Ofcourse if you don't need the comboboxes you could fill in [] and then you can use one line .. so it only counts when you want to use them.

Smartzkid

2008-01-09 17:21:55

I'm pretty sure you can do multidimensional arrays in one line.

EDIT: Tested, yes, you can. [['hi', 'hey'], ['bye', 'cya']]

Sumilion

2008-01-10 11:40:00

From: Smartzkid
I'm pretty sure you can do multidimensional arrays in one line.

EDIT: Tested, yes, you can. [['hi', 'hey'], ['bye', 'cya']]


Really ? If so that would be great … I tested it but I thought it gave me a Type Mismatch

program New;
var
Test : array of array of string;
begin
Test := [['sdf', 'sfsef'], ['sdfds']];
end.

Smartzkid

2008-01-10 11:57:52

Aye, just re-tested. I was wrong. No idea what I did before, but here's what I just wrote, and it doesn't work.



program New;

procedure PrintMultiDArray(ss: Array of Array of String);
var
i, b: integer;
begin
for i := 0 to High(ss) do
for b := 0 to High(ss[i]) do
writeln(ss[i][b]);
end;

begin
PrintMultiDArray([['hi', 'hey'], ['bye', 'cya']]);
end.

mastaraymond

2008-01-10 13:30:08

From: Smartzkid
Aye, just re-tested. I was wrong. No idea what I did before, but here's what I just wrote, and it doesn't work.



program New;

procedure PrintMultiDArray(ss: Array of Array of String);
var
i, b: integer;
begin
for i := 0 to High(ss) do
for b := 0 to High(ss[i]) do
writeln(ss[i][b]);
end;

begin
PrintMultiDArray([['hi', 'hey'], ['bye', 'cya']]);
end.

This would work though…

program New;

procedure PrintMultiDArray(ss: Array of Array of String);
var
i, b: integer;
begin
for i := 0 to High(ss) do
for b := 0 to High(ss[i]) do
writeln(ss[i][b]);
end;

Type
StrAr = TStringArray;
begin
Writeln('Long..');
PrintMultiDArray([TStrinGArray(['hi', 'hey']), TStringArray(['bye', 'cya'])]);
Writeln('Shorter..');
PrintMultiDArray([StrAr(['hi', 'hey']), StrAr(['bye', 'cya'])]);
end.