2004-06-08 19:58:59 +00:00
|
|
|
{
|
|
|
|
:: X2UtSettingsForm provides functions to read and write form settings.
|
|
|
|
::
|
|
|
|
:: Last changed: $Date$
|
|
|
|
:: Revision: $Rev$
|
|
|
|
:: Author: $Author$
|
|
|
|
}
|
|
|
|
unit X2UtSettingsForm;
|
|
|
|
|
|
|
|
interface
|
|
|
|
uses
|
|
|
|
Forms,
|
|
|
|
X2UtSettings;
|
|
|
|
|
|
|
|
procedure ReadFormPos(const AFactory: TX2SettingsFactory;
|
|
|
|
const ASection: String; const AForm: TCustomForm);
|
|
|
|
procedure WriteFormPos(const AFactory: TX2SettingsFactory;
|
|
|
|
const ASection: String; const AForm: TCustomForm);
|
|
|
|
|
|
|
|
implementation
|
|
|
|
type
|
|
|
|
THackCustomForm = class(TCustomForm);
|
|
|
|
|
2005-03-12 16:01:52 +00:00
|
|
|
procedure ReadFormPos(const AFactory: TX2SettingsFactory;
|
|
|
|
const ASection: String; const AForm: TCustomForm);
|
2004-06-08 19:58:59 +00:00
|
|
|
begin
|
|
|
|
with AFactory[ASection] do
|
2005-03-12 16:01:52 +00:00
|
|
|
try
|
|
|
|
if ReadBool('Maximized', (AForm.WindowState = wsMaximized)) then
|
|
|
|
AForm.WindowState := wsMaximized
|
|
|
|
else with THackCustomForm(AForm) do begin
|
|
|
|
WindowState := wsNormal;
|
|
|
|
Position := poDesigned;
|
|
|
|
Left := ReadInteger('Left', Left);
|
|
|
|
Top := ReadInteger('Top', Top);
|
|
|
|
Width := ReadInteger('Width', Width);
|
|
|
|
Height := ReadInteger('Height', Height);
|
2004-06-08 19:58:59 +00:00
|
|
|
end;
|
2005-03-12 16:01:52 +00:00
|
|
|
finally
|
|
|
|
Free();
|
|
|
|
end;
|
2004-06-08 19:58:59 +00:00
|
|
|
end;
|
|
|
|
|
2005-03-12 16:01:52 +00:00
|
|
|
procedure WriteFormPos(const AFactory: TX2SettingsFactory;
|
|
|
|
const ASection: String; const AForm: TCustomForm);
|
2004-06-08 19:58:59 +00:00
|
|
|
begin
|
|
|
|
with AFactory[ASection] do
|
2005-03-12 16:01:52 +00:00
|
|
|
try
|
|
|
|
WriteBool('Maximized', (AForm.WindowState = wsMaximized));
|
|
|
|
if AForm.WindowState <> wsMaximized then
|
|
|
|
with THackCustomForm(AForm) do begin
|
|
|
|
WriteInteger('Left', Left);
|
|
|
|
WriteInteger('Top', Top);
|
|
|
|
WriteInteger('Width', Width);
|
|
|
|
WriteInteger('Height', Height);
|
|
|
|
end;
|
|
|
|
finally
|
|
|
|
Free();
|
|
|
|
end;
|
2004-06-08 19:58:59 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|