From b17bb2c85bea870f83f921a0a517d561b9b2d454 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Fri, 21 Oct 2022 10:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化设计器相关细节 --- designer/utslvcldpropertytypes.tsf | 2 +- funcext/tvclib/tcomponent.tsf | 14 ++++++-------- funcext/tvclib/tslvcl.tsf | 21 ++++++++++++++------- funcext/tvclib/utslvclpage.tsf | 6 ++++-- funcext/tvclib/utslvclstdctl.tsf | 7 ++++++- 5 files changed, 31 insertions(+), 19 deletions(-) diff --git a/designer/utslvcldpropertytypes.tsf b/designer/utslvcldpropertytypes.tsf index 4d7cbc3..e09e902 100644 --- a/designer/utslvcldpropertytypes.tsf +++ b/designer/utslvcldpropertytypes.tsf @@ -770,7 +770,7 @@ type TPropGrid = class(TTSLDataGrid) end end end - return o.SetPublish(index,d); + //return o.SetPublish(index,d); end function WMMove(o,e):WM_MOVE;override; begin diff --git a/funcext/tvclib/tcomponent.tsf b/funcext/tvclib/tcomponent.tsf index 77ff011..eb5f1fe 100644 --- a/funcext/tvclib/tcomponent.tsf +++ b/funcext/tvclib/tcomponent.tsf @@ -287,6 +287,8 @@ public // function create(AOwner);virtual; begin class(TSLUIBASE).create(); + FChangedProperties := array(); + FChangedinheritedProperties := array(); FComponents := NEW TFpList(); FFreeNotifies := NEW TFpList(); FComponentStyle := array(csInheritable); @@ -453,7 +455,7 @@ public // #!end private //Éè¼ÆÆ÷ÖÐÊôÐÔʼþÏà¹Ø FEventsProperties; - FChangedPropertiesflg; + FChangedinheritedProperties; FChangedProperties; FVariableProperties; function GetPublishInfo();//ÊôÐÔ»ñÈ¡ @@ -555,9 +557,9 @@ public // for i,vi in ps do begin n := vi["name"]; - if (f<>2) and ifarray(FChangedPropertiesflg) and FChangedPropertiesflg[n] then continue; vv := FChangedProperties[n]; if ifnil(vv)then continue; + if (f<>2) and ( FChangedinheritedProperties[n]=vv) then continue; vit := vi["type"]; otype := GetComponentPropertyType(vit);//GetPropertyType(vit); if vi["write"]and otype then @@ -578,13 +580,8 @@ public // {** @explan(˵Ã÷) Éè¼ÆÆ÷Ïà¹Øº¯Êý %% **} - if not ifarray(FChangedProperties)then FChangedProperties := array(); - if not ifarray(FChangedPropertiesflg)then FChangedPropertiesflg := array(); - if pp then FChangedPropertiesflg[n] := true; - //reindex(FChangedProperties,array(n:nil)); - if FChangedProperties[n]=v then return ; + if pp then FChangedinheritedProperties[n] := v; FChangedProperties[n]:= v; - if not(pp) then reindex(FChangedPropertiesflg,array(n:nil)); end function DeleteChangedPublish(n);virtual;//ɾ³ýÊôÐÔ begin @@ -611,6 +608,7 @@ public // if ifobj(otype)then begin iv := otype.UnformatEdit(v); //·´×ª»» + if FChangedProperties[n]=vi then continue; //ûÓиıä SetChangedPublish(n,iv,pp); //±£´æ if vit="eventhandler" then //·ÖÀà±£´æ begin diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index a478f48..28ed44d 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -1769,7 +1769,8 @@ type tmemo = class(TSynMemoNorm) function DoTextChanged(p);override;//Îı¾¸Ä±ä begin inherited; - calldatafunction(Fonchange,self(true),new tuieventbase(0,0,0,0)); + if Fonchange then + calldatafunction(Fonchange,self(true),new tuieventbase(0,0,0,0)); end function MouseUp(o,e);override; begin @@ -3840,6 +3841,7 @@ type TListView = class(TDrawGrid) end function CallSelChanged(); begin + if OnSelChanged then return calldatafunction(OnSelChanged,self(true),new tuieventbase(0,0,0,0)); end function SetCanSelected(v); @@ -4515,7 +4517,8 @@ type tmonthcalendar = class(TCustomControl) r := FCalender.ExecuteCommand("meselbypos",e.pos); if std=3 or r="today" then begin - CallMessgeFunction(FonSelect,self(true),new tuieventbase(0,0,0,0)); + if FonSelect then + CallMessgeFunction(FonSelect,self(true),new tuieventbase(0,0,0,0)); end end end @@ -4554,7 +4557,8 @@ type tmonthcalendar = class(TCustomControl) end function DoDatechanged(); begin - CallMessgeFunction(FonSelectChange,self(true),new tuieventbase(0,0,0,0)); + if FonSelectChange then + CallMessgeFunction(FonSelectChange,self(true),new tuieventbase(0,0,0,0)); end function recycling();override; begin @@ -4686,7 +4690,8 @@ type tdatetimepicker = class(tthreeEntry) if d>ct then es[2].text := inttostr(ct); end end - calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); + if Fonselectchange then + calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); end "dtadate": begin @@ -4697,8 +4702,9 @@ type tdatetimepicker = class(tthreeEntry) decodedate(dt,y,m,d); es[0].text := inttostr(y); es[1].text := inttostr(m); - es[2].text := inttostr(d); - calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); + es[2].text := inttostr(d); + if Fonselectchange then + calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); end else begin y := strtointdef(es[0].text,2021); @@ -4861,7 +4867,8 @@ type ttimepicker = class(tthreeEntry) if ti<0 then p.text := "24"; else if ti>24 then p.text := "0"; end - calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); + if Fonselectchange then + calldatafunction(Fonselectchange,self(true),new tuieventbase(0,0,0,0)); end end end diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf index fb99dae..3cfad61 100644 --- a/funcext/tvclib/utslvclpage.tsf +++ b/funcext/tvclib/utslvclpage.tsf @@ -303,8 +303,10 @@ type tcustompagecontrol = class(TCustomControl) InsureIdxVisible(id); InvalidateRect(nil,false); DoControlAlign(); - doonSelChanging(self(true),new tuieventbase(0,0,0,0)); - doonSelChange(self(true),new tuieventbase(0,0,0,0)); + if OnSelChanging then + doonSelChanging(self(true),new tuieventbase(0,0,0,0)); + if OnSelChange then + doonSelChange(self(true),new tuieventbase(0,0,0,0)); end else if FTabItems.length()=0 then begin diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index ccfd26d..9aa986b 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -2398,11 +2398,14 @@ type tcustomedit=class(TCustomControl) end function doonmaxtext(); begin - CallMessgeFunction(FOnMaxText,self(true),new tuieventbase(0,0,0,0)); + if FOnMaxText then + CallMessgeFunction(FOnMaxText,self(true),new tuieventbase(0,0,0,0)); end function DoChanged(); begin + if FOnChange then CallMessgeFunction(FOnChange,self(true),new tuieventbase(0,0,0,0)); + if FOnUpdate then CallMessgeFunction(FOnUpdate,self(true),new tuieventbase(0,0,0,0)); end function FontChanged(sender);override; @@ -3292,6 +3295,7 @@ type TcustomListBox=class(TCustomListBoxbase) FSelBegin := FSelEnd := n; SelRange(true); SetYpos(n); + if FselectionChange then CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0)); end function getItemSelectedState(n); @@ -3330,6 +3334,7 @@ type TcustomListBox=class(TCustomListBoxbase) if FMultisel <> 2 or not isValidIndex(n)or b=getItemSelectedState(n)then return; if b then FMultisel3Data[n]:= b; else reindex(FMultisel3Data,array(n:nil)); + if FselectionChange then CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0)); InvalidateIdxRect(n); end