Restore maximized WindowStyle of grid text editor, and move some code from FormShow to FormCreate, to overcome a glitch with the window dimensions. Closes #89.

This commit is contained in:
Ansgar Becker
2018-02-16 15:45:18 +01:00
parent 52c3fb43a2
commit 32bc533495
2 changed files with 16 additions and 10 deletions

View File

@ -167,26 +167,31 @@ begin
menuMacLB.Tag := Integer(lbsMac);
menuWideLB.Tag := Integer(lbsWide);
menuMixedLB.Tag := Integer(lbsMixed);
// Restore form dimensions
Width := AppSettings.ReadInt(asMemoEditorWidth);
Height := AppSettings.ReadInt(asMemoEditorHeight);
if AppSettings.ReadBool(asMemoEditorMaximized) then
WindowState := wsMaximized;
if AppSettings.ReadBool(asMemoEditorWrap) then
btnWrap.Click;
// Fix label position:
lblTextLength.Top := tlbStandard.Top + (tlbStandard.Height-lblTextLength.Height) div 2;
end;
procedure TfrmTextEditor.FormDestroy(Sender: TObject);
begin
AppSettings.WriteInt(asMemoEditorWidth, Width);
AppSettings.WriteInt(asMemoEditorHeight, Height);
if WindowState <> wsMaximized then begin
AppSettings.WriteInt(asMemoEditorWidth, Width);
AppSettings.WriteInt(asMemoEditorHeight, Height);
end;
AppSettings.WriteBool(asMemoEditorMaximized, WindowState=wsMaximized);
AppSettings.WriteBool(asMemoEditorWrap, btnWrap.Down);
end;
procedure TfrmTextEditor.FormShow(Sender: TObject);
begin
// Restore form dimensions
Width := AppSettings.ReadInt(asMemoEditorWidth);
Height := AppSettings.ReadInt(asMemoEditorHeight);
if AppSettings.ReadBool(asMemoEditorWrap) then
btnWrap.Click;
// Fix label position:
lblTextLength.Top := tlbStandard.Top + (tlbStandard.Height-lblTextLength.Height) div 2;
FmemoText.SetFocus;
end;