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

@ -135,7 +135,7 @@ type
asLogToFile, asMainWinMaximized, asMainWinLeft, asMainWinTop, asMainWinWidth,
asMainWinHeight, asMainWinOnMonitor, asCoolBandIndex, asCoolBandBreak, asCoolBandWidth, asQuerymemoheight, asDbtreewidth,
asDataPreviewHeight, asDataPreviewEnabled, asLogHeight, asQueryhelperswidth, asStopOnErrorsInBatchMode,
asWrapLongLines, asDisplayBLOBsAsText, asSingleQueries, asMemoEditorWidth, asMemoEditorHeight,
asWrapLongLines, asDisplayBLOBsAsText, asSingleQueries, asMemoEditorWidth, asMemoEditorHeight, asMemoEditorMaximized,
asMemoEditorWrap, asDelimiter, asSQLHelpWindowLeft, asSQLHelpWindowTop, asSQLHelpWindowWidth,
asSQLHelpWindowHeight, asSQLHelpPnlLeftWidth, asSQLHelpPnlRightTopHeight, asTableEditorTabsHeight, asHost,
asUser, asPassword, asWindowsAuth, asLoginPrompt, asPort,
@ -3351,6 +3351,7 @@ begin
InitSetting(asSingleQueries, 'SingleQueries', 0, True);
InitSetting(asMemoEditorWidth, 'MemoEditorWidth', 100);
InitSetting(asMemoEditorHeight, 'MemoEditorHeight', 100);
InitSetting(asMemoEditorMaximized, 'MemoEditorMaximized', 0, False);
InitSetting(asMemoEditorWrap, 'MemoEditorWrap', 0, False);
InitSetting(asDelimiter, 'Delimiter', 0, False, ';');
InitSetting(asSQLHelpWindowLeft, 'SQLHelp_WindowLeft', 0);

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
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;