From 276838003249c29e0149057720d42fa9892b99b1 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Wed, 28 Jun 2023 14:38:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 测试 --- designer/udesignerproject.tsf | 3 +- funcext/tvclib/utslvcldlg.tsf | 1 - funcext/tvclib/utslvclpage.tsf | 60 +++++++++++++------ tsdata/param/StockRefDatebyEndt.param | 16 +++++ tsdata/param/StocktTrailingAvgByEndT.param | 22 +++++++ tsdata/param/StocktTrailingStdByEndT.param | 22 +++++++ .../中间函数/StockRefDatebyEndt.tsf | 51 ++++++++++++++++ .../中间函数/StocktTrailingAvgByEndT.tsf | 34 +++++++++++ .../中间函数/StocktTrailingStdByEndT.tsf | 34 +++++++++++ 9 files changed, 222 insertions(+), 21 deletions(-) create mode 100644 tsdata/param/StockRefDatebyEndt.param create mode 100644 tsdata/param/StocktTrailingAvgByEndT.param create mode 100644 tsdata/param/StocktTrailingStdByEndT.param create mode 100644 tsdata/股票/行情因子/中间函数/StockRefDatebyEndt.tsf create mode 100644 tsdata/股票/行情因子/中间函数/StocktTrailingAvgByEndT.tsf create mode 100644 tsdata/股票/行情因子/中间函数/StocktTrailingStdByEndT.tsf diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index a34853b..37d7ccc 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -1846,7 +1846,8 @@ end end function GetVCLdir(); begin - return Getfuncextdir()+ioFileseparator()+"tvclib"; + //return Getfuncextdir()+ioFileseparator()+"tvclib"; + return Getfuncextdir();//+ioFileseparator()+"tvclib"; return tsl; end function Getfuncextdir(); diff --git a/funcext/tvclib/utslvcldlg.tsf b/funcext/tvclib/utslvcldlg.tsf index 7ce193b..9834a74 100644 --- a/funcext/tvclib/utslvcldlg.tsf +++ b/funcext/tvclib/utslvcldlg.tsf @@ -1294,7 +1294,6 @@ type TEditAndBtnUni=class(tcustomcontrol) function DoControlAlign();override; begin c := clientRect; - echo tostn(c); FBtn.SetBoundsRect(array(C[2]-18,1,C[2]-3,c[3]-2)); FText.SetBoundsRect(array(c[0]+1,c[1]+1,c[2]-22,c[3]-2)); end diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf index 8e61399..c1b9aff 100644 --- a/funcext/tvclib/utslvclpage.tsf +++ b/funcext/tvclib/utslvclpage.tsf @@ -58,14 +58,29 @@ type tcustompagecontrol = class(TCustomControl) FTabRects; FClientarea; private + function gettabsheetitem(idx); + begin + if idx>=0 and idx=0 then return FTabItems[idx]; + if idx>=0 and idx=0 then return FTabItems[id]; + if id>=0 then return FTabItems[id].PageSheet; end function SetTabPosition(v); begin @@ -471,6 +486,12 @@ type tcustompagecontrol = class(TCustomControl) end return r; end + function checknewchild(achild);override;//child + begin + r := inherited; + if isacceptsheettype( achild) then achild.Align := alNone; + return r; + end function getsheetrect(); //sheet begin {** @@ -625,25 +646,25 @@ type tcustompagecontrol = class(TCustomControl) CalcTabs(); for i := 0 to FTabItems.length()-1 do begin - it := FTabItems[i]; - pg := it.PageSheet; - if it and pg then + pg := FTabItems[i].PageSheet; + if not pg then continue; + pg.Align := alNone; + if i=FCurrentid then begin - if i=FCurrentid then + pg.Visible := true; + rc := getsheetrect(); + if not rc then return ; + rc[1]+=1; + if csDesigning in ComponentState then begin - pg.Visible := true; - rc := getsheetrect(); - if not rc then return ; - rc[1]+=1; - if csDesigning in ComponentState then - begin - rc[0]+=2; - rc[2]-=2; - rc[3]-=2; - end - pg.SetBoundsrect(rc); - end else - pg.Visible := false; + rc[0]+=2; + rc[2]-=2; + rc[3]-=2; + end + pg.SetBoundsrect(rc); + end else + begin + pg.Visible := false; end end end @@ -726,6 +747,7 @@ type tcustompagecontrol = class(TCustomControl) property TabCount read GetTabCount; property TabPosition:tabalign read FTabPosition write SetTabPosition; property tabsheet read gettabesheet ; + property tabsheetitem:tcustomtabitem read gettabsheetitem; property onmeasuretabwidth:eventhandler read fonmeasuretabwidth write fonmeasuretabwidth; property ondrawtab:eventhandler read fondrawtab write fondrawtab; property ownerdraw:bool read fownerdraw write fownerdraw; diff --git a/tsdata/param/StockRefDatebyEndt.param b/tsdata/param/StockRefDatebyEndt.param new file mode 100644 index 0000000..ee01737 --- /dev/null +++ b/tsdata/param/StockRefDatebyEndt.param @@ -0,0 +1,16 @@ +nameStockRefDatebyEndt +nicknameָ +comment +infoƱ;;м亯 +typeid16777217 +id10 +id20 +id30 +id40 +ctrl +param +array( +("paramname":"Endt","paramcomment":"ֹ","datatype":3,"value": +("value":44393,"cv":"44393")), +("paramname":"RefType","paramcomment":"","datatype":17,"value": +("value":"=12\x0112\x02\x031=0\x031=1\x033=2\x036=3\x031=4\x032=5\x033=6\x035=7\x03=8\x03=9\x03=10\x03=11\x03=12\x03","cv":"12"))) diff --git a/tsdata/param/StocktTrailingAvgByEndT.param b/tsdata/param/StocktTrailingAvgByEndT.param new file mode 100644 index 0000000..24ec6de --- /dev/null +++ b/tsdata/param/StocktTrailingAvgByEndT.param @@ -0,0 +1,22 @@ +nameStocktTrailingAvgByEndT +nicknameȡָƽ׶εվָ +comment +infoƱ;;м亯 +typeid16777217 +id10 +id20 +id30 +id40 +ctrl +param +array( +("paramname":"Endt","paramcomment":"ֹ","datatype":3,"value": +("value":44393,"cv":"44393")), +("paramname":"RefType","paramcomment":"","datatype":17,"value": +("value":"=12\x0112\x02\x031=0\x031=1\x033=2\x036=3\x031=4\x032=5\x033=6\x035=7\x03=8\x03=9\x03=10\x03=11\x03=12\x03","cv":"12")), +("paramname":"Exp","paramcomment":"ָʽ","datatype":16,"value": +("value":"@stockzdf3()","cv":"@stockzdf3()")), +("paramname":"IsExcludeIPO","paramcomment":"Ƿ޳","datatype":1,"value": +("value":1,"cv":"1")), +("paramname":"N","paramcomment":"޳","datatype":0,"value": +("value":3,"cv":"3"))) diff --git a/tsdata/param/StocktTrailingStdByEndT.param b/tsdata/param/StocktTrailingStdByEndT.param new file mode 100644 index 0000000..f4bd170 --- /dev/null +++ b/tsdata/param/StocktTrailingStdByEndT.param @@ -0,0 +1,22 @@ +nameStocktTrailingStdByEndT +nicknameȡָƽ׶εָ׼ +comment +infoƱ;;м亯 +typeid16777217 +id10 +id20 +id30 +id40 +ctrl +param +array( +("paramname":"Endt","paramcomment":"ֹ","datatype":3,"value": +("value":44393,"cv":"44393")), +("paramname":"RefType","paramcomment":"","datatype":17,"value": +("value":"=12\x0112\x02\x031=0\x031=1\x033=2\x036=3\x031=4\x032=5\x033=6\x035=7\x03=8\x03=9\x03=10\x03=11\x03=12\x03","cv":"12")), +("paramname":"Exp","paramcomment":"ָʽ","datatype":16,"value": +("value":"@stockzdf3()","cv":"@stockzdf3()")), +("paramname":"IsExcludeIPO","paramcomment":"Ƿ޳","datatype":1,"value": +("value":1,"cv":"1")), +("paramname":"N","paramcomment":"޳","datatype":0,"value": +("value":3,"cv":"3"))) diff --git a/tsdata/股票/行情因子/中间函数/StockRefDatebyEndt.tsf b/tsdata/股票/行情因子/中间函数/StockRefDatebyEndt.tsf new file mode 100644 index 0000000..b317fde --- /dev/null +++ b/tsdata/股票/行情因子/中间函数/StockRefDatebyEndt.tsf @@ -0,0 +1,51 @@ +Function StockRefDatebyEndt(Endt,RefType); +Begin +{** ======================================================================// + %% @explain(˵): + ļָָڣԱںȡ + %% : + %% @param(EndT)(TDateTime) ڣֹ + %% @param(RefType) ûԶ壬ѡͣȡֵ£ + 0: 1 + 1: 1 + ... + 12:Ҫϵͳ֤ȯ룩 + + %% : ֵڣ + %% @remark(־) 2021-07-14 TSҵ + +%%//====================================================================== **} + case RefType of + 0: //1 + begt := IncWeek(EndT,-1)+1; + 1: //1 + begt := IncMonth(EndT,-1)+1; + 2: //3 + begt := IncMonth(EndT,-2)+1; + 3: //6 + begt := IncMonth(EndT,-3)+1; + 4: //1 + begt := IncYear(EndT,-1)+1; + 5: //2 + begt := IncYear(EndT,-2)+1; + 6: //3 + begt := IncYear(EndT,-3)+1; + 7: //5 + begt := IncYear(EndT,-5)+1; + 8: // + begt := StartOfTheWeek(EndT); + 9: // + begt := StartOfTheMonth(EndT); + 10: // + begt := StartOfTheQuarter(EndT); + 11: // + begt := StartOfTheYear(EndT); + 12: //ָȡʼ + begt := ifthen(stocktype(DefaultStockID())=-1,base(750004),firstday()); + else + begt := endt; + end; + + return begt; + +End; diff --git a/tsdata/股票/行情因子/中间函数/StocktTrailingAvgByEndT.tsf b/tsdata/股票/行情因子/中间函数/StocktTrailingAvgByEndT.tsf new file mode 100644 index 0000000..4c1b227 --- /dev/null +++ b/tsdata/股票/行情因子/中间函数/StocktTrailingAvgByEndT.tsf @@ -0,0 +1,34 @@ +Function StocktTrailingAvgByEndT(Endt,RefType,Exp,IsExcludeIPO,N); +Begin +{** ======================================================================// + %% @explain(˵): + ȡָƽ׶εվָ + %% : + %% @param(EndT)(TDateTime) ڣֹ + %% @param(RefType) ûԶ壬ѡͣȡֵ£ + 0: 1 + 1: 1 + ... + 12: + %% @param(Exp)(exp) ָʽ@close(),@stockzdf3() + %% @param(IsExcludeIPO)(Bool) Ƿ޳ + %% @param(N)(Int) ޳ + %% : ֵreal + %% @remark(־) 2021-07-14 TSҵ + +%%//====================================================================== **} + ov := BackupSystemParameters2(); + if ifnil(IsExcludeIPO) then IsExcludeIPO:=0; + if ifnil(N) then N:=1; + setsysparam(pn_date(),endt); + setsysparam(pn_cycle(),cy_day()); + begt := StockRefDatebyEndt(Endt,RefType); + ND := tradedays(begt,endt); + if IsExcludeIPO then + begin + MD := tradedays(firstday(),sp_time()); + ND := MD-ND<=N?MD-N:ND; + end + return MA(eval(Exp),ND); + +End; diff --git a/tsdata/股票/行情因子/中间函数/StocktTrailingStdByEndT.tsf b/tsdata/股票/行情因子/中间函数/StocktTrailingStdByEndT.tsf new file mode 100644 index 0000000..fc0a469 --- /dev/null +++ b/tsdata/股票/行情因子/中间函数/StocktTrailingStdByEndT.tsf @@ -0,0 +1,34 @@ +Function StocktTrailingStdByEndT(Endt,RefType,Exp,IsExcludeIPO,N); +Begin +{** ======================================================================// + %% @explain(˵): + ȡָƽ׶εָ׼ + %% : + %% @param(EndT)(TDateTime) ڣֹ + %% @param(RefType) ûԶ壬ѡͣȡֵ£ + 0: 1 + 1: 1 + ... + 12: + %% @param(Exp)(exp) ָʽ@close(),@stockzdf3() + %% @param(IsExcludeIPO)(Bool) Ƿ޳ + %% @param(N)(Int) ޳ + %% : ֵreal + %% @remark(־) 2021-07-14 TSҵ + +%%//====================================================================== **} + ov := BackupSystemParameters2(); + if ifnil(IsExcludeIPO) then IsExcludeIPO:=0; + if ifnil(N) then N:=1; + setsysparam(pn_date(),endt); + setsysparam(pn_cycle(),cy_day()); + begt := StockRefDatebyEndt(Endt,RefType); + ND := tradedays(begt,endt); + if IsExcludeIPO then + begin + MD := tradedays(firstday(),sp_time()); + ND := MD-ND<=N?MD-N:ND; + end + return sp_Std(eval(Exp),ND); + +End;