Skip to content

Commit

Permalink
fix: readd TEdit and TMemo .Create methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Torwent committed Nov 19, 2024
1 parent 9504832 commit ed95ed0
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions utils/forms/formutils.simba
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,53 @@ begin
end;


procedure TCustomEdit.Create(owner: TControl);
procedure TEdit.Create(owner: TControl);
begin
Self.Init(owner);
Self.SetParent(owner);
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);
Self.SetCaption(caption);
Self.SetHint(hint);
end;

procedure TEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint; adjustDPI: Boolean); overload;
begin
if adjustDPI then
begin
topLeft := [TControl.AdjustToDPI(topLeft.X), TControl.AdjustToDPI(topLeft.Y)];
dimensions := [TControl.AdjustToDPI(dimensions.X), TControl.AdjustToDPI(dimensions.Y)];
end;

Self.Create(owner, caption, hint, topLeft, dimensions);
end;

procedure TEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions, offset: TPoint; adjustDPI: Boolean); overload;
begin
if adjustDPI then
begin
topLeft := [TControl.AdjustToDPI(topLeft.X), TControl.AdjustToDPI(topLeft.Y)];
dimensions := [TControl.AdjustToDPI(dimensions.X), TControl.AdjustToDPI(dimensions.Y)];
end;

Self.Create(owner, caption, hint, topleft + offset, dimensions, False);
end;


procedure TMemo.Create(owner: TControl);
begin
Self.Init(owner);
Self.SetParent(owner);
end;

procedure TCustomEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
procedure TMemo.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint); overload;
begin
Self.Create(owner);
Self.SetTop(topLeft.Y);
Expand All @@ -407,7 +447,7 @@ begin
Self.SetHint(hint);
end;

procedure TCustomEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint; adjustDPI: Boolean); overload;
procedure TMemo.Create(owner: TControl; caption, hint: String; topleft, dimensions: TPoint; adjustDPI: Boolean); overload;
begin
if adjustDPI then
begin
Expand All @@ -418,7 +458,7 @@ begin
Self.Create(owner, caption, hint, topLeft, dimensions);
end;

procedure TCustomEdit.Create(owner: TControl; caption, hint: String; topleft, dimensions, offset: TPoint; adjustDPI: Boolean); overload;
procedure TMemo.Create(owner: TControl; caption, hint: String; topleft, dimensions, offset: TPoint; adjustDPI: Boolean); overload;
begin
if adjustDPI then
begin
Expand Down

0 comments on commit ed95ed0

Please sign in to comment.