Skip to content

Commit

Permalink
fix(formutils): improved some logic with the newly added component co…
Browse files Browse the repository at this point in the history
…nstructors
  • Loading branch information
Torwent committed Nov 23, 2024
1 parent 41201f9 commit b5b337e
Showing 1 changed file with 76 additions and 76 deletions.
152 changes: 76 additions & 76 deletions utils/forms/formutils.simba
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,10 @@ end;
procedure TPanel.Create(owner: TControl; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
end;

procedure TPanel.Create(owner: TControl; topleft, dimensions: TPoint; adjustDPI: Boolean); overload;
Expand Down Expand Up @@ -359,10 +359,10 @@ end;
procedure TLabel.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -399,10 +399,10 @@ end;
procedure TEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -439,10 +439,10 @@ end;
procedure TMemo.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -480,10 +480,10 @@ end;
procedure TButton.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -520,10 +520,10 @@ end;
procedure TCheckBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -561,10 +561,10 @@ end;
procedure TRadioButton.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -602,10 +602,10 @@ end;
procedure TComboBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -642,10 +642,10 @@ end;
procedure TListBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -682,10 +682,10 @@ end;
procedure TTrackBar.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -722,10 +722,10 @@ end;
procedure TSimbaImageBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Self.SetLeft(topLeft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2121,10 +2121,10 @@ end;
procedure TLabeledPanel.Create(owner: TControl; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
end;

procedure TLabeledPanel.Create(owner: TControl; topleft, dimensions: TPoint; adjustDPI: Boolean); overload;
Expand Down Expand Up @@ -2153,10 +2153,10 @@ end;
procedure TLabeledEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2188,10 +2188,10 @@ end;
procedure TLabeledComboBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2223,10 +2223,10 @@ end;
procedure TLabeledCheckBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2257,10 +2257,10 @@ end;
procedure TLabeledListBox.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2291,10 +2291,10 @@ end;
procedure TLabeledMemo.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2325,10 +2325,10 @@ end;
procedure TLabeledTrackBar.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down Expand Up @@ -2359,10 +2359,10 @@ end;
procedure TCheckCheckGroup.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topleft.Y);
Self.SetLeft(topleft.X);
Self.SetWidth(dimensions.X);
Self.SetHeight(dimensions.Y);
if topleft.X > 0 then Self.SetLeft(topleft.X);
if topleft.Y > 0 then Self.SetTop(topleft.Y);
if dimensions.X > 0 then Self.SetWidth(dimensions.X);
if dimensions.Y > 0 then Self.SetHeight(dimensions.Y);
Self.SetCaption(caption);
Self.SetHint(hint);
end;
Expand Down

0 comments on commit b5b337e

Please sign in to comment.