summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b23d093)
raw | patch | inline | side by side (parent: b23d093)
author | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 26 Sep 2017 06:27:29 +0000 (09:27 +0300) | ||
committer | Ketmar Dark <ketmar@ketmar.no-ip.org> | |
Tue, 26 Sep 2017 06:37:11 +0000 (09:37 +0300) |
src/gx/gh_ui.pas | patch | blob | history | |
src/shared/xparser.pas | patch | blob | history |
diff --git a/src/gx/gh_ui.pas b/src/gx/gh_ui.pas
index 46bbbf6565225c771f8f69d6cb845d2ff9daf8e5..ee54d5c5550dcb6a8389dcdf212fb64b8911bbe2 100644 (file)
--- a/src/gx/gh_ui.pas
+++ b/src/gx/gh_ui.pas
mWaitingClose: Boolean;
mInClose: Boolean;
mFreeOnClose: Boolean; // default: false
+ mDoCenter: Boolean; // after layouting
protected
procedure activated (); override;
lay.layout();
//writeln('=== final ==='); lay.dump();
+ if (ctl.mParent = nil) and (ctl is THTopWindow) and (THTopWindow(ctl).mDoCenter) then
+ begin
+ THTopWindow(ctl).centerInScreen();
+ end;
+
finally
FreeAndNil(lay);
end;
result := true;
exit;
end;
+ if (strEquCI1251(prname, 'position')) then
+ begin
+ if (par.eatIdOrStr('default', false)) then mDoCenter := false
+ else if (par.eatIdOrStr('center', false)) then mDoCenter := true
+ else par.error('`center` or `default` expected');
+ result := true;
+ exit;
+ end;
if (parseOrientation(prname, par)) then begin result := true; exit; end;
result := inherited parseProperty(prname, par);
end;
diff --git a/src/shared/xparser.pas b/src/shared/xparser.pas
index 0f2c2ece5b06731f2a18d6c4a46dcf15e445f7d3..a3e39cef4d5ac642c2aab3ee8abfa33f253b707c 100644 (file)
--- a/src/shared/xparser.pas
+++ b/src/shared/xparser.pas
procedure expectId (const aid: AnsiString; caseSens: Boolean=true);
function eatId (const aid: AnsiString; caseSens: Boolean=true): Boolean;
function eatIdOrStr (const aid: AnsiString; caseSens: Boolean=true): Boolean;
+ function eatIdOrStrCI (const aid: AnsiString): Boolean; inline;
function expectStr (allowEmpty: Boolean=false): AnsiString;
function expectInt (): Integer;
end;
+function TTextParser.eatIdOrStrCI (const aid: AnsiString): Boolean; inline;
+begin
+ result := eatIdOrStr(aid, false);
+end;
+
+
function TTextParser.expectStr (allowEmpty: Boolean=false): AnsiString;
begin
if (mTokType <> TTStr) then raise Exception.Create('string expected');