From 39d57baf2e9a279a4ec210a5f08a5fb946aa4313 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Mon, 31 Oct 2022 11:51:52 +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 淇combobox bug --- funcext/tvclib/utslvclpage.tsf | 80 ++++++++++++++++---------------- funcext/tvclib/utslvclstdctl.tsf | 8 +++- 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf index 3cfad61..0f5ce3f 100644 --- a/funcext/tvclib/utslvclpage.tsf +++ b/funcext/tvclib/utslvclpage.tsf @@ -10,7 +10,7 @@ type tcustomtabitem = class() //TTCITEMA FCaption; FVisible; FPageSheet; - function SetVisible(v); + function SetVisible(v);//设置可见 begin nv := v?true:false; if nv<>FVisible then @@ -18,7 +18,7 @@ type tcustomtabitem = class() //TTCITEMA FVisible := v; end end - function SetCaption(s); + function SetCaption(s);//设置标签 begin if ifstring(s) and s<>FCaption then begin @@ -28,14 +28,14 @@ type tcustomtabitem = class() //TTCITEMA end end public - function Create(); + function Create();//构造 begin FVisible:= true; end property Caption read FCaption write SetCaption; property PageSheet read FPageSheet Write FPageSheet; end -type tcustomtabsheet = class(TCustomControl) +type tcustomtabsheet = class(TCustomControl) //控件页面 {** @explan(说明)page控件页面 %% **} @@ -51,7 +51,7 @@ type tcustomtabsheet = class(TCustomControl) Parent.SetTabText(id,s); end end - function SetParent(p);override; + function SetParent(p);override; //设置父窗口 begin if (P is class(tcustompagecontrol) ) and parent<>p then begin @@ -61,7 +61,7 @@ type tcustomtabsheet = class(TCustomControl) oldparent.RemovePage(self); end inherited; - parent.addtabitem(self); + parent.addtabitem(self(true)); end else if not(p is class(TWincontrol)) then begin @@ -74,15 +74,15 @@ type tcustomtabsheet = class(TCustomControl) end end public - function paint();override; + function paint();override; //设计器模式下绘制网格 begin drawdesigninggrid(); end - function DesigningMove();override; + function DesigningMove();override;//移动 begin return false; end - function DesigningSizer();override; + function DesigningSizer();override;//调整大小 begin return false; end @@ -91,7 +91,6 @@ type tcustomtabsheet = class(TCustomControl) inherited; Caption := "tab"; Visible := false; - FTabVisible := True; end function CreateParams(p);override; begin @@ -101,13 +100,12 @@ type tcustomtabsheet = class(TCustomControl) end type tcustompagecontrol = class(TCustomControl) private - FirstViewIndex; + FirstViewIndex; //第一个展示的序号 FCurrentid; FPrevid; - FTabItems; // - + FTabItems; // FOnSelChange; - FOnSelChanging; + FOnSelChanging; //正在改变 //FOnrclick; FTabPosition; FTabHeight; @@ -298,15 +296,21 @@ type tcustompagecontrol = class(TCustomControl) if FCurrentid= id then return ; if id>=0 and id0 then return FTabItems[AIndex].Caption; return r; end - function IsContainer(cd);override; + function IsContainer(cd);override;//是否容纳 begin if cd is class(tcustomtabsheet) then return true; return false; end - function GetPageID(page); + function GetPageID(page);//获得page序号 begin {** @explan(说明)获取page的序号 %% @@ -521,7 +522,7 @@ type tcustompagecontrol = class(TCustomControl) end return r; end - function DoControlAlign();override; + function DoControlAlign();override;//调整位置 begin CalcTabs(); for i := 0 to FTabItems.length()-1 do @@ -548,7 +549,7 @@ type tcustompagecontrol = class(TCustomControl) end end end - function RemovePageTab(id); + function RemovePageTab(id);//移除sheet begin if not(id>=0) then return ; FTabItems.splice(id,1); @@ -570,7 +571,7 @@ type tcustompagecontrol = class(TCustomControl) CalcTabs(); InvalidateRect(nil,false); end - function RemovePage(i); + function RemovePage(i);//移除sheet begin {** @explan(说明)移除page %% @@ -635,8 +636,7 @@ type tcustompagecontrol = class(TCustomControl) function InitializeWnd();override; begin inherited; - end - + end function AppendPage(page); begin {** diff --git a/funcext/tvclib/utslvclstdctl.tsf b/funcext/tvclib/utslvclstdctl.tsf index e3059d5..15b8298 100644 --- a/funcext/tvclib/utslvclstdctl.tsf +++ b/funcext/tvclib/utslvclstdctl.tsf @@ -4048,10 +4048,12 @@ type TcustomComboBox=class(TCustomComboBoxbase) end FEdit.onchange := function(o,e); begin + if feditischanging then return feditischanging := false; if not(o.Readonly) then begin feditischanging := true; - CallMessgeFunction(Foneditchanged,o,e); + if Foneditchanged then + CallMessgeFunction(Foneditchanged,o,e); if FMultisel then return feditischanging:=false; t := o.Text; if t = getCurrentItemText() then return ; @@ -4083,7 +4085,9 @@ type TcustomComboBox=class(TCustomComboBoxbase) begin if feditischanging then return ; r := getCurrentItemText(); - FEdit.Text := r; + feditischanging := true; + FEdit.Text := r; + feditischanging := false; ShowDropDown(false); CallMessgeFunction(OnSelchanged,self(true),e); end