界面库

优化
This commit is contained in:
JianjunLiu 2023-02-23 17:54:28 +08:00
parent 12cba8c0ec
commit c425e0cb91
13 changed files with 34 additions and 36 deletions

View File

@ -2194,7 +2194,7 @@ type TEditer=class(TCustomcontrol) //
end end
end else //±»ÆäËû³ÌÐòÐÞ¸Ä end else //±»ÆäËû³ÌÐòÐÞ¸Ä
begin begin
if Messageboxa(format("%s\r\n被其他程序修改是否重新加载",it.ScriptPath),"提示",1,self)=IDOK then if Messageboxa(format("%s\r\n被其他程序修改是否重新加载",it.ScriptPath),"提示",mb_YesNo,self)=IDYES then
begin begin
LoadFromFile(it,true); LoadFromFile(it,true);
end else end else

View File

@ -1846,7 +1846,6 @@ type tcpointer=class(tcstruct,tmemoryclass)
begin begin
//echo "\r\nreade:",_ptr; //echo "\r\nreade:",_ptr;
v := _tool.readstr(_ptr); v := _tool.readstr(_ptr);
//echo "readv:" ,v,datatype(v);
return v; return v;
end else end else
begin begin

View File

@ -277,7 +277,7 @@ type tcontrol = class(tcomponent)
@explan(说明) 绑定处理函数到消息id %% @explan(说明) 绑定处理函数到消息id %%
**} **}
if not ifarray(FMessagehandle)then FMessagehandle := array(); if not ifarray(FMessagehandle)then FMessagehandle := array();
if ifnumber(id)and (datatype(func)=7)then FMessagehandle[id]:= func; if ifnumber(id)and (iffuncptr(func))then FMessagehandle[id]:= func;
end end
private //事件绑定处理 private //事件绑定处理
static FClassDigestA; static FClassDigestA;

View File

@ -21,7 +21,7 @@ type tcustomcontrol=class(TWinControl)
procedure Paint();override; procedure Paint();override;
begin begin
inherited; inherited;
if datatype(FOnPaint)=7 then call(FOnPaint,self(true)); if iffuncptr(FOnPaint) then call(FOnPaint,self(true));
end end
function ControlAppended(AControl);override; function ControlAppended(AControl);override;
begin begin

View File

@ -39,7 +39,7 @@ type tgraphiccontrol = class(TControl)
{** {**
@explan(说明)控件绘制调用 ,使用Canvas属性和PAINTSTRUCT结构体 绘制控件 %% @explan(说明)控件绘制调用 ,使用Canvas属性和PAINTSTRUCT结构体 绘制控件 %%
**} **}
if(datatype(FOnPaint)<> 7)or(not call(FOnPaint,self(true)))then if(not iffuncptr(FOnPaint))or(not call(FOnPaint,self(true)))then
begin begin
canvas.Font := font; canvas.Font := font;
Canvas.DrawText(self.caption,self.ClientRect,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX); Canvas.DrawText(self.caption,self.ClientRect,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);

View File

@ -3680,7 +3680,7 @@ type TListView = class(TDrawGrid)
{** {**
@explan(说明) 检查项目 %% @explan(说明) 检查项目 %%
**} **}
if datatype(FOnCheckItem)=7 then if iffuncptr(FOnCheckItem) then
begin begin
return call(FOnCheckItem,v); return call(FOnCheckItem,v);
end end
@ -6366,7 +6366,7 @@ begin
pc := paramcount; pc := paramcount;
if pc<1 then return nil; if pc<1 then return nil;
f := params[1]; f := params[1];
if datatype(f)<> 7 then return nil; if not iffuncptr(f) then return nil;
case pc of case pc of
1:return call(f); 1:return call(f);
2:return call(f,params[2]); 2:return call(f,params[2]);
@ -6374,18 +6374,6 @@ begin
4:return call(f,params[2],params[3],params[4]); 4:return call(f,params[2],params[3],params[4]);
end; end;
return nil; return nil;
{ps := params;
f := ps[0];
pms := ps[1:];
if datatype(f)<> 7 or not(ifarray(pms))then exit;
info := f.functioninfo();
pt := info["parameter"];
lpt := length(pt);
if(lpt=0)or length(pms)<= lpt then
begin
return callinarray(f,pms);
end else
return callinarray(f,pms[0:lpt-1]);}
end end
function NotifyComponent(Acomponent,Act,AOwner);//通知控件 function NotifyComponent(Acomponent,Act,AOwner);//通知控件
begin begin

View File

@ -5744,7 +5744,7 @@ type tgtk_ctl_object = class(_gtkeventtype)
begin begin
xxid := pms[1]; xxid := pms[1];
c := FConnectHandlers[inttostr(xxid)]; c := FConnectHandlers[inttostr(xxid)];
if datatype(c)=7 then if iffuncptr(c) then
begin begin
pms2 := pms; pms2 := pms;
pms2[0] := self; pms2[0] := self;

View File

@ -113,7 +113,7 @@ TYPE TMemoLineList=class(tnumindexarray) //
function DoColumnIncreased(); function DoColumnIncreased();
begin begin
//echo "\r\nIncreate:",FRowMaxLength; //echo "\r\nIncreate:",FRowMaxLength;
//if Datatype(FOnMaxLengthIncrease)=7 then Call(FOnMaxLengthIncrease); //if iffuncptr(FOnMaxLengthIncrease) then Call(FOnMaxLengthIncrease);
//echo "\r\nincrease:",FRowMaxLength; //echo "\r\nincrease:",FRowMaxLength;
end end
FEdit; FEdit;
@ -289,7 +289,7 @@ type TTslMenoUndoList=class() //undolist
begin begin
if fLockCount>0 then return nil; if fLockCount>0 then return nil;
fItems.push(Item); fItems.push(Item);
if datatype(fOnAdded)=7 then call(fOnAdded,Self(true)); if iffuncptr(fOnAdded) then call(fOnAdded,Self(true));
end end
public public
function MergeReplaceItem(); //ºÏ²¢²Ù×÷ function MergeReplaceItem(); //ºÏ²¢²Ù×÷

View File

@ -32,7 +32,7 @@ type TBasicAction=class(TComponent)
**} **}
procedure Change;virtual; procedure Change;virtual;
begin begin
if datatype(FOnChange)=7 then call(FOnChange,self); if iffuncptr(FOnChange) then call(FOnChange,self);
end end
procedure SetOnExecute(Value:TNotifyEvent);virtual; procedure SetOnExecute(Value:TNotifyEvent);virtual;
begin begin
@ -81,7 +81,7 @@ type TBasicAction=class(TComponent)
if FOnExecute then if FOnExecute then
begin begin
e := new tuieventbase(0,0,0,0); e := new tuieventbase(0,0,0,0);
if datatype(FOnExecute)=7 then call(FOnExecute,self(true),e); if iffuncptr(FOnExecute) then call(FOnExecute,self(true),e);
return true; return true;
end end
return false; return false;
@ -355,7 +355,7 @@ type TBasicActionLink=class(TSLUIBASE)
end end
procedure Change;virtual; procedure Change;virtual;
begin begin
if datatype(FOnChange)=7 then call(OnChange,FAction); if iffuncptr(FOnChange) then call(OnChange,FAction);
end end
function IsOnExecuteLinked():Boolean;virtual; function IsOnExecuteLinked():Boolean;virtual;
begin begin

View File

@ -5,6 +5,7 @@ unit utslvclauxiliary;
//20221118 抽象计数锁定对象 //20221118 抽象计数锁定对象
//20220914 移入tire树 //20220914 移入tire树
interface interface
function iffuncptr(fn);
function includestate(u,s); function includestate(u,s);
function excludestate(u,s); function excludestate(u,s);
function makelong(low,high,ptrl); function makelong(low,high,ptrl);
@ -357,8 +358,8 @@ type tarray1dlk=class //
end end
function CallCompare(v1,v2,f); function CallCompare(v1,v2,f);
begin begin
if datatype(f)=7 then return call(f,v1,v2); if iffuncptr(f) then return call(f,v1,v2);
if datatype(FCompareValue)=7 then return call(FCompareValue,v1,v2); if iffuncptr(FCompareValue)then return call(FCompareValue,v1,v2);
return v1=v2; return v1=v2;
end end
function append(v) //追加 function append(v) //追加
@ -538,7 +539,7 @@ type tarray1dlk=class //
@explan(说明) 循环所有数据 %% @explan(说明) 循环所有数据 %%
@param(f)(fpointer) 处理函数 function(id,v) begin end %% @param(f)(fpointer) 处理函数 function(id,v) begin end %%
**} **}
if(datatype(f)<> 7)then return nil; if not iffuncptr(f)then return nil;
for i,v in _data do for i,v in _data do
begin begin
ret := call(f,i,v); //## f(i,v); ret := call(f,i,v); //## f(i,v);
@ -2250,6 +2251,11 @@ type tinstancemanager = class()
fhandles; fhandles;
end end
implementation implementation
function iffuncptr(fn);
begin
//return datatype(fn)=7;
return ifobj(fn);
end
function includestate(u,s); function includestate(u,s);
begin begin
{** {**
@ -2841,7 +2847,7 @@ begin
{** {**
@ignore(忽略) @ignore(忽略)
**} **}
if datatype(f)=7 then return call(f,o,e); if iffuncptr(f) then return call(f,o,e);
end end
function CheckArrayIsNumbers(Value,n); function CheckArrayIsNumbers(Value,n);
begin begin
@ -3010,7 +3016,7 @@ begin
//d:天软数据 //d:天软数据
//tbw : 字符串,tab 宽度 //tbw : 字符串,tab 宽度
//ct 递归深度,忽略 //ct 递归深度,忽略
case datatype(d)of case datatype(d) of
0,20:return inttostr(d); 0,20:return inttostr(d);
1:return floattostr(d); 1:return floattostr(d);
2:return tostn(d); 2:return tostn(d);

View File

@ -1732,7 +1732,7 @@ type TCustomImageList=class(tcomponent)
{** {**
@explan(说明) 修改时的回调 %%; @explan(说明) 修改时的回调 %%;
**} **}
if FChanged and (datatype(FOnChange)=7) then call(FOnChange,self(true)); if FChanged and (iffuncptr(FOnChange)) then call(FOnChange,self(true));
FChanged := false; FChanged := false;
end end
function GetIconSize(); function GetIconSize();

View File

@ -236,7 +236,7 @@ type TCustomTimer = class(tcomponent)//
{** {**
@explan(说明)启动 %% @explan(说明)启动 %%
**} **}
if not((datatype(FOntimer) = 7 )and FInterval)>0 then return -1; if not(iffuncptr(FOntimer) and FInterval>0) then return -1;
if FStart then return FStart; if FStart then return FStart;
ret := _wapi.SetTimer(nil,Fid,FInterval,gettimerptr(2)); ret := _wapi.SetTimer(nil,Fid,FInterval,gettimerptr(2));
_kill0 := ret; _kill0 := ret;

View File

@ -28,7 +28,7 @@ type tworkerclient = class(TArray)
end end
function DoOnMessage(d); //执行onmessage 任务 function DoOnMessage(d); //执行onmessage 任务
begin begin
if datatype(FOnMessage)=7 then if iffuncptr(FOnMessage) then
begin begin
try try
return call(FOnMessage,self,d); return call(FOnMessage,self,d);
@ -291,7 +291,7 @@ type tworkerHost = class(TArray)
FConnectHandle := h; FConnectHandle := h;
if h then if h then
begin begin
if datatype(FOnStart)=7 then if iffuncptr(FOnStart) then
begin begin
try try
call(FOnStart,self); call(FOnStart,self);
@ -330,7 +330,7 @@ type tworkerHost = class(TArray)
end end
function DoOnError(d);//处理错误 function DoOnError(d);//处理错误
begin begin
if datatype(FOnError)=7 then if iffuncptr(FOnError) then
begin begin
try try
return call(FOnError,self,d); return call(FOnError,self,d);
@ -340,7 +340,7 @@ type tworkerHost = class(TArray)
end end
function DoOnMessage(d); //处理数据 function DoOnMessage(d); //处理数据
begin begin
if datatype(FOnMessage)=7 then if iffuncptr(FOnMessage) then
begin begin
try try
return call(FOnMessage,self,d); return call(FOnMessage,self,d);
@ -363,5 +363,10 @@ type tworkerHost = class(TArray)
FOnStart; FOnStart;
FConnectHandle; //句柄 FConnectHandle; //句柄
end end
function iffuncptr(fn);
begin
//return datatype(fn)=7;
return ifobj(fn);
end
initialization initialization
end. end.