SRL Archive - Bugs

Form size is off


MylesMadness

2010-06-25 20:34:32

Scar:
Simba:

Same exact code

EvilChicken!

2010-06-25 20:43:50

Hmm.
Show code?
Might help for finding an explanation to this.

MylesMadness

2010-06-25 20:49:38

program New;
{.include srl/srl.scar}
var
EndInitForm : Boolean;
Form1 : TForm;
Label1 : TLabel;
Edit1, Edit2, Edit3, Edit4 : TEdit;
ComboBox1, ComboBox2 : TComboBox;
Button1, Button2, Button3, Button4 : TButton;
Memo1 : TMemo;
PageControl : TPageControl;
TabPages : array [0..1] of TTabSheet;
I:Integer;
Names:TStringArray;

procedure InitFormOnClose(Sender : TObject; var Action : TCloseAction);
begin
if (not(Form1.ModalResult = 1)) then
EndInitForm := True;
end;
{Edit1.text:='Username';
Edit2.text:='Password';
Edit3.text:='Nick';
Edit4.text:='Pin';
cbActive.Text}

Procedure Click(Sender : TObject);
var
Tmp, I:integer;
begin
Tmp:=StrToInt(Label1.Caption);
Case Sender of
Button1, Button2:
begin
If (Sender = Button1) and (Tmp = 0) then
exit;
If (Sender = Button2) and (GetArrayLength(Players) = TMP) then
Exit;
Players[Tmp].Name := Edit1.text;
Players[Tmp].Pass := Edit2.text;
Players[Tmp].Nick := Edit3.text;
Players[Tmp].Pin := Edit4.text;
Players[Tmp].Strings[0] := ComboBox1.text;
Players[Tmp].Strings[1] := ComboBox2.text;
Players[Tmp].Active := True;
If Sender = Button1 then
I:=Tmp-1
else
I:=Tmp+1;
Edit1.text:=Players[I].Name;
Edit2.text:=Players[I].Pass;
Edit3.text:=Players[I].Nick;
Edit4.text:=Players[I].Pin;
ComboBox1.text := Players[Tmp].Strings[0];
ComboBox2.text := Players[Tmp].Strings[1];
end;
Button3, Button4:
begin
If (Sender = Button4) and (GetArrayLength(Players) = 0) then
exit;
If Sender = Button3 then
begin
SetArrayLength(Players, GetArrayLength(Players) + 1);
Players[High(Players)].Name := 'Username';
Players[High(Players)].Pass := 'Password';
Players[High(Players)].Nick := 'Nick';
Players[High(Players)].Strings[0] := '';
Players[High(Players)].Strings[1] := '';
Players[High(Players)].Active := True;
end else
SetArrayLength(Players, GetArrayLength(Players) - 1);
I:=High(Players);
Edit1.text:=Players[I].Name;
Edit2.text:=Players[I].Pass;
Edit3.text:=Players[I].Nick;
Edit4.text:=Players[I].Pin;
ComboBox1.text := Players[Tmp].Strings[0];
ComboBox2.text := Players[Tmp].Strings[1];
end;
end;
end;

procedure InitForm;
begin
Form1 := CreateForm;
with Form1 do
begin
OnClose := @InitFormOnClose;
Width := 280;
Height := 310;
Caption := 'TBN';
end;
PageControl := TPageControl.Create(Form1);
With PageControl do
begin
Parent := Form1;
Align := alClient;
end;
SetArrayLength(Names, 2);
Names:=['Players', 'News'];
for i := 0 to 1 do
begin
TabPages[i] := TTabSheet.Create(Form1);
TabPages[i].Caption := Names[I];
TabPages[i].PageControl := PageControl;
end;
Label1 := TLabel.Create(Form1);
with Label1 do
begin
Parent := TabPages[0];
Left := 130;
Top := 208;
Width := 15;
Height := 13;
Alignment := taCenter;
Caption := '0';
end;
Edit1 := TEdit.Create(Form1);
with Edit1 do
begin
Parent := TabPages[0];
Left := 8;
Top := 8;
Width := 241;
Height := 21;
TabOrder := 0;
Text := 'Username';
end;
Edit2 := TEdit.Create(Form1);
with Edit2 do
begin
Parent := TabPages[0];
Left := 8;
Top := 40;
Width := 241;
Height := 21;
TabOrder := 1;
Text := 'Password';
end;
Edit3 := TEdit.Create(Form1);
with Edit3 do
begin
Parent := TabPages[0];
Left := 8;
Top := 72;
Width := 241;
Height := 21;
TabOrder := 2;
Text := 'Nickname';
end;
Edit4 := TEdit.Create(Form1);
with Edit4 do
begin
Parent := TabPages[0];
Left := 8;
Top := 104;
Width := 241;
Height := 21;
TabOrder := 3;
Text := 'Pin';
end;
ComboBox1 := TComboBox.Create(Form1);
with ComboBox1 do
begin
Parent := TabPages[0];
Left := 8;
Top := 136;
Width := 241;
Height := 21;
ItemHeight := 13;
TabOrder := 4;
Text := 'Location';
with Items do
begin
Add('Varock');
Add('Edgeville');
end;
end;
ComboBox2 := TComboBox.Create(Form1);
with ComboBox2 do
begin
Parent := TabPages[0];
Left := 8;
Top := 168;
Width := 241;
Height := 21;
ItemHeight := 13;
TabOrder := 5;
Text := 'Pick a location first!';
end;
Button1 := TButton.Create(Form1);
with Button1 do
begin
Parent := TabPages[0];
Left := 8;
Top := 192;
Width := 35;
Height := 49;
Caption := '<--';
TabOrder := 6;
Onclick := @Click;
end;
Button2 := TButton.Create(Form1);
with Button2 do
begin
Parent := TabPages[0];
Left := 215;
Top := 192;
Width := 35;
Height := 49;
Caption := '-->';
TabOrder := 7;
Onclick := @Click;
end;
Button3 := TButton.Create(Form1);
with Button3 do
begin
Parent := TabPages[0];
Left := 178;
Top := 192;
Width := 35;
Height := 49;
Caption := 'Add';
TabOrder := 6;
Onclick := @Click;
end;
Button4 := TButton.Create(Form1);
with Button4 do
begin
Parent := TabPages[0];
Left := 49;
Top := 192;
Width := 35;
Height := 49;
Caption := 'Del';
TabOrder := 7;
Onclick := @Click;
end;
Memo1 := TMemo.Create(Form1);
with Memo1 do
begin
Parent := TabPages[1];
Left := 0;
Top := 0;
Width := 280;
Height := 240;
end;
end;

procedure SafeInitForm;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowInitFormModal;
begin
Form1.ShowModal;
end;

procedure SafeShowInitFormModal;
var
v : TVariantArray;
begin
SetArrayLength(v, 0);
ThreadSafeCall('ShowInitFormModal', v);
end;

procedure MainInitForm;
begin
try
SafeInitForm;
SafeShowInitFormModal;
finally
FreeForm(Form1);
except
WriteLn('An error seems to have occurred in: InitForm');
end;
end;

begin
ClearDebug;
MainInitForm;
if (EndInitForm) then
TerminateScript;
end.

Gu3st...

2010-06-26 14:29:29

Yeah, same for me.. That is indeed weird…

MylesMadness

2010-06-26 14:40:01

So is simba making the size wrong, or was scar wrong and no one ever realized it.

Gu3st...

2010-06-26 15:06:57

EDIT: Nevermind, I don't know :P

Frement

2010-06-26 15:06:58

The bigger is the correct one.

Gu3st...

2010-06-26 15:10:07

Actually Scar is correct
open these links:
http://img.techpowerup.org/100626/Capture051.png
http://img.techpowerup.org/100626/Capture050.png

and look at the title

You'll see scar has the right proportionals

Wizzup?

2010-06-26 15:14:02

Zyt3x, I don't see how that proves anything. Most likely both handle forms a different way. It may look ``off'' with Simba, but different assumptions may have to be made when making the form.

Gu3st...

2010-06-26 15:20:55

From: Wizzup?
Zyt3x, I don't see how that proves anything. Most likely both handle forms a different way. It may look ``off'' with Simba, but different assumptions may have to be made when making the form.
Hmm.. I forgot not all browsers show image sizes…

Scar ^[INDENT][INDENT][INDENT][INDENT][INDENT]Simba ^[/INDENT][/INDENT][/INDENT][/INDENT][/INDENT]

EDIT:
Oh, and:

Form1 := CreateForm;
with Form1 do
begin
OnClose := @InitFormOnClose;
Width := 280;
Height := 310;
Caption := 'TBN';
end;

Frement

2010-06-26 15:24:57

I thought the borders dont count?

MylesMadness

2010-06-26 15:42:43

Well, shouldn't they handle the forms the same? So scar counts the borders while simba doesn't?

Gu3st...

2010-06-26 15:45:55

Why shouldn't the borders count?

ReadySteadyGo

2010-06-26 21:07:53

for me it's scar that's off… and that's when designing it in photoshop and putting everything correctly in the form.

i luffs yeww

2010-06-26 21:09:48

^ wat

How could it be different for different people? =X

ReadySteadyGo

2010-06-26 21:18:23

let me try myles' form

Wanted

2010-06-26 21:22:17

Just some clarification

The 'size' in SCAR refers to the entire thing including any borders ect. whileas in simba it refers to only the canvas editable part of it.

Different people think differently, it may seem off when working with photoshop and having specific dimensions that are different when porting to your form because you haven't compensated for the border widths (unless you use borderstyle := none)

It's a question of which one is proper in the real world, and I'm having trouble finding documentation of which one is considered 'proper' (including the borders in the width/height or not)

It wouldn't be hard for you to put a {$DEF Simba} in there

Frement

2010-06-26 21:31:03

I truly believe that the proper way is to exclude the borders. Why would someone want to include the borders in the width? In XP and in Vista their widths are different, so that would make the form bigger in XP then in Vista.

ReadySteadyGo

2010-06-26 21:41:30

I agree as you can't program OS specific. But I don't think it matters that much because Simba is correct and once the public release is made most people will use Simba.

i luffs yeww

2010-06-26 21:42:03

^ >_> No matter what they would be different.. (@Frement)

Dan Cardin

2010-06-26 22:01:13

i don't know if Simba has client width/height but im fairly sure you could use that to make them both the same (because in scar they yield different sizes). Which leads me to believe that Simba's width and height should be the same as SCAR's since their clientheight and width are very likely the same as regular height and width. I can't check because i cannot get your silly form working in Simba, but that is what I think.

MylesMadness

2010-06-26 22:04:13

I made my silly form in simba, and it works for me besides the whole size thing…

Dan Cardin

2010-06-26 22:19:53

:O well i have problems then, but i still think that's the problem and think its a problem on Simba's part. clientWidth and clientHeight should be the ones that exclude the border else they'll have two things that do the same thing. In which case, if you want them to look the same, use client______.

MylesMadness

2010-06-26 22:26:36

Well, it didn't work until the newest simba update so you could be out of date? Anyway Clientheight and width fixed it. But this still should be looked at to see what is proper here

Wizzup?

2010-06-28 06:39:49

From: Dan Cardin
:O well i have problems then, but i still think that's the problem and think its a problem on Simba's part. clientWidth and clientHeight should be the ones that exclude the border else they'll have two things that do the same thing. In which case, if you want them to look the same, use client______.


Did the update work?

Dan Cardin

2010-06-28 10:52:07

nah, i was already updated; it was a problem on my own part, but even so, are you dev types considering fixing width and height?

Wizzup?

2010-06-29 02:41:35

From: Dan Cardin
nah, i was already updated; it was a problem on my own part, but even so, are you dev types considering fixing width and height?


It's a feature in Lazarus/LCL, so I don't think there is anything to be fixed. :)

Dan Cardin

2010-06-29 09:23:00

Having two redundant attributes is a feature.

Wizzup?

2010-06-29 12:22:45

From: Dan Cardin
Having two redundant attributes is a feature.


As stated previously, if you want it ``fixed'' you should be at the Lazarus project. They probably have their reasons for doing it this way.

MylesMadness

2010-06-29 12:26:23

So scar just never really did it right?

Wizzup?

2010-06-29 12:30:27

From: MylesMadness
So scar just never really did it right?


From: IceFire908
Different people think differently, it may seem off when working with photoshop and having specific dimensions that are different when porting to your form because you haven't compensated for the border widths (unless you use borderstyle := none)

It's a question of which one is proper in the real world, and I'm having trouble finding documentation of which one is considered 'proper' (including the borders in the width/height or not)


I think that summarizes it nicely. There's not really a proper or wrong way, I think.

Wanted

2010-06-29 13:09:30

I actually find this more convenient for development, though it doesn't really matter either way if you know how to work around it.