Skip to content

Commit

Permalink
fAuth: fix form height.
Browse files Browse the repository at this point in the history
  • Loading branch information
horacekj committed Jan 20, 2024
1 parent 4d7e08c commit 2ab7b35
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions src/forms/fAuth.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ TAuthLevelDesc = record
save_hint: '';
)
);
BODY_DEFAULT_TOP: Integer = 8;
MSG_BODY_SPACE: Integer = 20;

type
TAuthFilledCallback = procedure(Sender: TObject; username: string; password: string; ors: TList<Integer>; guest: boolean)
Expand Down Expand Up @@ -89,6 +91,7 @@ TF_Auth = class(TForm)
procedure ShowRelogin();

procedure UpdateCheckboxLayout();
procedure UpdateFormHeight();

public
procedure OpenForm(caption: string; callback: TAuthFilledCallback; or_ids: TList<Integer>; allow_guest: boolean;
Expand Down Expand Up @@ -381,8 +384,8 @@ procedure TF_Auth.AuthOK(or_index: Integer);
procedure TF_Auth.ShowErrorMessage();
begin
Self.P_Message.Visible := true;
Self.P_Body.Top := Self.P_Message.Height + 20;
Self.Height := P_Body.Top + P_Body.Height + P_Message.Top + 20;
Self.P_Body.Top := Self.P_Message.Height + MSG_BODY_SPACE;
Self.UpdateFormHeight();

Self.ST_Error.Visible := true;
Self.P_Message.Color := $DEDEF2;
Expand All @@ -391,9 +394,9 @@ procedure TF_Auth.ShowErrorMessage();

procedure TF_Auth.HideErrorMessage();
begin
Self.P_Body.Top := 8;
Self.Height := P_Body.Top + P_Body.Height + P_Message.Top + 20;
Self.P_Body.Top := BODY_DEFAULT_TOP;
Self.P_Message.Visible := false;
Self.UpdateFormHeight();
end;

/// /////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -480,7 +483,12 @@ procedure TF_Auth.UpdateCheckboxLayout();

Self.P_Buttons.Top := Top;
Self.P_Body.Height := Top + Self.P_Buttons.Height;
Self.Height := Self.P_Body.Top + Self.P_Body.Height + Self.P_Message.Top + 20;
Self.UpdateFormHeight();
end;

procedure TF_Auth.UpdateFormHeight();
begin
Self.ClientHeight := Self.P_Body.Top + Self.P_Body.Height + BODY_DEFAULT_TOP;
end;

/// /////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions src/hJOPpanel.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<DCC_MapFile>3</DCC_MapFile>
<VerInfo_Keys>CompanyName=;FileDescription=hJOPpanel;FileVersion=1.16.3.0;InternalName=hJOPpanel.exe;LegalCopyright=Jan Horáček;LegalTrademarks=Jan Horáček;OriginalFilename=hJOPpanel.exe;ProductName=hJOPpanel;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Release>3</VerInfo_Release>
<VerInfo_Keys>CompanyName=;FileDescription=hJOPpanel;FileVersion=1.16.4.0;InternalName=hJOPpanel.exe;LegalCopyright=Jan Horáček;LegalTrademarks=Jan Horáček;OriginalFilename=hJOPpanel.exe;ProductName=hJOPpanel;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Release>4</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
Expand All @@ -121,6 +120,7 @@
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_Keys>CompanyName=;FileDescription=hJOPpanel;FileVersion=1.16.4.0;InternalName=hJOPpanel.exe;LegalCopyright=Jan Horáček;LegalTrademarks=Jan Horáček;OriginalFilename=hJOPpanel.exe;ProductName=hJOPpanel;ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Release>4</VerInfo_Release>
<Debugger_RunParams>panely/Depo.ini</Debugger_RunParams>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win64)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
Expand Down

0 comments on commit 2ab7b35

Please sign in to comment.