parent
39d57baf2e
commit
fe6e2c7eae
|
|
@ -1129,14 +1129,6 @@ type tcontrol = class(tcomponent)
|
||||||
end
|
end
|
||||||
return array(x,y);
|
return array(x,y);
|
||||||
end
|
end
|
||||||
function IsContainer(cd);virtual;
|
|
||||||
begin
|
|
||||||
{
|
|
||||||
@explan(说明)判断当前是否可以作为容器 %%
|
|
||||||
@param(cd)(tcontrol 及其子类) cd 是否可以为子项 %%
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
end
|
|
||||||
function getid();
|
function getid();
|
||||||
begin
|
begin
|
||||||
return Fid;
|
return Fid;
|
||||||
|
|
@ -1180,7 +1172,7 @@ type tcontrol = class(tcomponent)
|
||||||
@ignore(忽略)
|
@ignore(忽略)
|
||||||
@explan(说明) 判断是否可以作为父节点
|
@explan(说明) 判断是否可以作为父节点
|
||||||
}
|
}
|
||||||
return(AParent is getparenttype())and AParent.IsContainer(self(true));
|
return(AParent is getparenttype()) ;//and AParent.IsContainer(self(true));
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
function Recycling();override; //销毁处理
|
function Recycling();override; //销毁处理
|
||||||
|
|
|
||||||
|
|
@ -154,10 +154,6 @@ type tgraphiccontrol = class(TControl)
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
function IsContainer(cd);override;
|
|
||||||
begin
|
|
||||||
return false;
|
|
||||||
end
|
|
||||||
function Create(AOwner:TComponent);override;
|
function Create(AOwner:TComponent);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
|
||||||
|
|
@ -1300,14 +1300,6 @@ type TVCForm = class(TScrollingWinControl)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
function IsContainer(cd);override;
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 重写该方法,该类可以作为容器 %%
|
|
||||||
**}
|
|
||||||
if cd is class(TComponent)then return Controls.indexof(cd)<0;
|
|
||||||
return true;
|
|
||||||
end
|
|
||||||
function Paint();override;
|
function Paint();override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
@ -2239,7 +2231,7 @@ type TListBox = class(TcustomListBox)
|
||||||
"height","width","left","top","items",
|
"height","width","left","top","items",
|
||||||
"multisel","checkbox","popupmenu","wsdlgmodalframe",
|
"multisel","checkbox","popupmenu","wsdlgmodalframe",
|
||||||
"onmousedown","onmouseup",
|
"onmousedown","onmouseup",
|
||||||
"onselectionchange"
|
"onselchanged"
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -2339,7 +2331,7 @@ type TColorbox=class(TcustomListBox)
|
||||||
"height","width","left","top",
|
"height","width","left","top",
|
||||||
"wsdlgmodalframe","popupmenu","parentcolor","parentfont",
|
"wsdlgmodalframe","popupmenu","parentcolor","parentfont",
|
||||||
"onmousedown","onmouseup",
|
"onmousedown","onmouseup",
|
||||||
"onselectionchange"
|
"onselchanged"
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
private
|
private
|
||||||
|
|
@ -2357,7 +2349,7 @@ type TColorCombobox=class(TCustomComboBoxbase)
|
||||||
inherited;
|
inherited;
|
||||||
FListBox.visible := false;
|
FListBox.visible := false;
|
||||||
FListBox.WsPopUp := true;
|
FListBox.WsPopUp := true;
|
||||||
FListBox.onSelectionChange := function(o,e)
|
FListBox.onselchanged := function(o,e)
|
||||||
begin
|
begin
|
||||||
if o.visible then
|
if o.visible then
|
||||||
begin
|
begin
|
||||||
|
|
@ -2984,7 +2976,7 @@ type tpagecontrol = class(tcustompagecontrol)
|
||||||
begin
|
begin
|
||||||
return array("name","left","top","width","height",
|
return array("name","left","top","width","height",
|
||||||
"align","anchors","color","font","parentcolor","parentfont","border","caption","popupmenu","enabled","visible","cursel","cursor",
|
"align","anchors","color","font","parentcolor","parentfont","border","caption","popupmenu","enabled","visible","cursel","cursor",
|
||||||
"wsdlgmodalframe","wssizebox","OnSelChange");
|
"wsdlgmodalframe","wssizebox","onselchange");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
//二分控件
|
//二分控件
|
||||||
|
|
@ -4495,10 +4487,6 @@ type tmonthcalendar = class(TCustomControl)
|
||||||
FCalender.top := 1;
|
FCalender.top := 1;
|
||||||
FCalender.host := self(true);
|
FCalender.host := self(true);
|
||||||
end
|
end
|
||||||
function isContainer(cd);override;
|
|
||||||
begin
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
function paint();override;
|
function paint();override;
|
||||||
begin
|
begin
|
||||||
if FCalender then FCalender.paint();
|
if FCalender then FCalender.paint();
|
||||||
|
|
@ -4909,10 +4897,6 @@ type ttimepicker = class(tthreeEntry)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function isContainer(cd);override;
|
|
||||||
begin
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
function getTime();override;begin
|
function getTime();override;begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)获取控件当前选择的时间%%
|
@explan(说明)获取控件当前选择的时间%%
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,6 @@
|
||||||
unit utslvclpage;
|
unit utslvclpage;
|
||||||
interface
|
interface
|
||||||
uses utslvclauxiliary,utslvclbase,utslvclgdi;
|
uses utslvclauxiliary,utslvclbase,utslvclgdi;
|
||||||
type tcustomtabitem = class() //TTCITEMA
|
|
||||||
{**
|
|
||||||
@explan(说明)tab控件标签对象 %%
|
|
||||||
**}
|
|
||||||
private
|
|
||||||
FPageCtrl;
|
|
||||||
FCaption;
|
|
||||||
FVisible;
|
|
||||||
FPageSheet;
|
|
||||||
function SetVisible(v);//设置可见
|
|
||||||
begin
|
|
||||||
nv := v?true:false;
|
|
||||||
if nv<>FVisible then
|
|
||||||
begin
|
|
||||||
FVisible := v;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function SetCaption(s);//设置标签
|
|
||||||
begin
|
|
||||||
if ifstring(s) and s<>FCaption then
|
|
||||||
begin
|
|
||||||
FCaption := s;
|
|
||||||
psztext := FCaption;
|
|
||||||
if PageSheet is class(tcustomtabsheet) then PageSheet.Caption := s;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
public
|
|
||||||
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控件页面 %%
|
@explan(说明)page控件页面 %%
|
||||||
|
|
@ -51,28 +17,6 @@ type tcustomtabsheet = class(TCustomControl) //
|
||||||
Parent.SetTabText(id,s);
|
Parent.SetTabText(id,s);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SetParent(p);override; //设置父窗口
|
|
||||||
begin
|
|
||||||
if (P is class(tcustompagecontrol) ) and parent<>p then
|
|
||||||
begin
|
|
||||||
oldparent := Parent;
|
|
||||||
if oldparent then
|
|
||||||
begin
|
|
||||||
oldparent.RemovePage(self);
|
|
||||||
end
|
|
||||||
inherited;
|
|
||||||
parent.addtabitem(self(true));
|
|
||||||
end else
|
|
||||||
if not(p is class(TWincontrol)) then
|
|
||||||
begin
|
|
||||||
if Parent then
|
|
||||||
begin
|
|
||||||
id := Parent.GetPageID(self);
|
|
||||||
Parent.RemovePageTab(id);
|
|
||||||
end
|
|
||||||
inherited;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
public
|
public
|
||||||
function paint();override; //设计器模式下绘制网格
|
function paint();override; //设计器模式下绘制网格
|
||||||
begin
|
begin
|
||||||
|
|
@ -89,22 +33,23 @@ type tcustomtabsheet = class(TCustomControl) //
|
||||||
function create(AOwner);override;
|
function create(AOwner);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
WsDlgModalFrame := true;
|
||||||
Caption := "tab";
|
Caption := "tab";
|
||||||
Visible := false;
|
Visible := false;
|
||||||
end
|
end
|
||||||
function CreateParams(p);override;
|
{function CreateParams(p);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
p.exstyle := 0x101;
|
p.exstyle := 0x101;
|
||||||
end
|
end }
|
||||||
end
|
end
|
||||||
type tcustompagecontrol = class(TCustomControl)
|
type tcustompagecontrol = class(TCustomControl)
|
||||||
private
|
private
|
||||||
FirstViewIndex; //第一个展示的序号
|
FirstViewIndex; //第一个展示的序号
|
||||||
FCurrentid;
|
FCurrentid; //当前
|
||||||
FPrevid;
|
FPrevid; //上一个
|
||||||
FTabItems; //
|
FTabItems; //
|
||||||
FOnSelChange;
|
FOnSelChanged;
|
||||||
FOnSelChanging; //正在改变
|
FOnSelChanging; //正在改变
|
||||||
//FOnrclick;
|
//FOnrclick;
|
||||||
FTabPosition;
|
FTabPosition;
|
||||||
|
|
@ -120,8 +65,8 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if FTabPosition=v then exit;
|
if FTabPosition=v then exit;
|
||||||
if not(v in array(alTop,alBottom,alLeft,alRight)) then exit;
|
if not(v in array(alTop,alBottom,alLeft,alRight)) then exit;
|
||||||
FTabPosition := v;
|
FTabPosition := v;
|
||||||
InvalidateRect(nil,false);
|
|
||||||
DoControlAlign();
|
DoControlAlign();
|
||||||
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
function GetTabCount();
|
function GetTabCount();
|
||||||
begin
|
begin
|
||||||
|
|
@ -129,7 +74,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end
|
end
|
||||||
function CreateTableItem(cp);
|
function CreateTableItem(cp);
|
||||||
begin
|
begin
|
||||||
r := new tcustomtabitem();
|
r := new tcustomtabitem();
|
||||||
r.caption := cp;
|
r.caption := cp;
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
|
|
@ -218,8 +163,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
alTop:
|
alTop:
|
||||||
begin
|
begin
|
||||||
if FTabItemswidth then
|
if FTabItemswidth then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
FClientarea[1] :=rec[1]+FTabHeight;
|
FClientarea[1] :=rec[1]+FTabHeight;
|
||||||
if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then
|
if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -244,8 +188,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
alBottom:
|
alBottom:
|
||||||
begin
|
begin
|
||||||
if FTabItemswidth then
|
if FTabItemswidth then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
FClientarea[3] :=rec[3]-FTabHeight;
|
FClientarea[3] :=rec[3]-FTabHeight;
|
||||||
if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then
|
if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -287,8 +230,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
FirstViewIndex--;
|
FirstViewIndex--;
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function setselidx(id); //选择序号
|
function setselidx(id); //选择序号
|
||||||
|
|
@ -296,7 +238,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if FCurrentid= id then return ;
|
if FCurrentid= id then return ;
|
||||||
if id>=0 and id<FTabItems.length() then
|
if id>=0 and id<FTabItems.length() then
|
||||||
begin
|
begin
|
||||||
if OnSelChanging then
|
if fOnSelChanging then
|
||||||
begin
|
begin
|
||||||
e := new tuieventbase(0,FPrevid,FCurrentid,0); //m,w,l,h
|
e := new tuieventbase(0,FPrevid,FCurrentid,0); //m,w,l,h
|
||||||
doonSelChanging(self(true),e);
|
doonSelChanging(self(true),e);
|
||||||
|
|
@ -307,7 +249,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
InsureIdxVisible(id);
|
InsureIdxVisible(id);
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
DoControlAlign();
|
DoControlAlign();
|
||||||
if OnSelChange then
|
if FOnSelChanged then
|
||||||
begin
|
begin
|
||||||
doonSelChange(self(true),new tuieventbase(0,FPrevid,FCurrentid,0));
|
doonSelChange(self(true),new tuieventbase(0,FPrevid,FCurrentid,0));
|
||||||
end
|
end
|
||||||
|
|
@ -326,11 +268,10 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
rec := FTabRects[i];
|
rec := FTabRects[i];
|
||||||
dc.pen.color := rgb(200,200,200);
|
dc.pen.color := rgb(200,200,200);
|
||||||
if rec then
|
if rec then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
if FCurrentid=i then
|
if FCurrentid=i then
|
||||||
begin
|
begin
|
||||||
dc.brush.color := rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
|
dc.brush.color := 0xf0f0f0;//rgb(100,192,250);//rgb(230,240,250);//rgb(200,200,200);
|
||||||
end else dc.brush.color := rgb(254,254,254);
|
end else dc.brush.color := rgb(254,254,254);
|
||||||
dc.draw("roundrect",array(rec[0:1],rec[2:3],array(2,2)));
|
dc.draw("roundrect",array(rec[0:1],rec[2:3],array(2,2)));
|
||||||
//dc.draw("rectangle",array(rec[0:1],rec[2:3],array(5,5)));
|
//dc.draw("rectangle",array(rec[0:1],rec[2:3],array(5,5)));
|
||||||
|
|
@ -358,8 +299,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
rc1 := array((FScrollBtnRect[0]+1,FScrollBtnRect[3]-FTabHeight+1),FScrollBtnRect[2:3]-1);
|
rc1 := array((FScrollBtnRect[0]+1,FScrollBtnRect[3]-FTabHeight+1),FScrollBtnRect[2:3]-1);
|
||||||
dc.draw("framecontrol",rc1,DFC_SCROLL,DFCS_SCROLLDOWN);
|
dc.draw("framecontrol",rc1,DFC_SCROLL,DFCS_SCROLLDOWN);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function ScrollPrev(); //滚动到下一个
|
function ScrollPrev(); //滚动到下一个
|
||||||
|
|
@ -384,15 +324,59 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
alLeft,alRight :
|
alLeft,alRight :
|
||||||
begin
|
begin
|
||||||
if rec and (rec[3]<Fprevrect[1]) then return ;
|
if rec and (rec[3]<Fprevrect[1]) then return ;
|
||||||
end
|
end
|
||||||
|
|
||||||
end ;
|
end ;
|
||||||
FirstViewIndex++ ;
|
FirstViewIndex++ ;
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
function RemovePageTab(id);//移除sheet
|
||||||
|
begin
|
||||||
|
if not(id>=0) then return ;
|
||||||
|
FTabItems.splice(id,1);
|
||||||
|
if id = FCurrentid then
|
||||||
|
begin
|
||||||
|
if id = 0 then
|
||||||
|
begin
|
||||||
|
if FTabItems.length()=0 then
|
||||||
|
begin
|
||||||
|
FCurrentid := -1;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return setselidx(id-1);
|
||||||
|
end else
|
||||||
|
if id<FCurrentid then
|
||||||
|
begin
|
||||||
|
FCurrentid--;
|
||||||
|
end
|
||||||
|
CalcTabs();
|
||||||
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
|
function addtabitem(page);//添加sheet
|
||||||
|
begin
|
||||||
|
//if not(page is class(tcustomtabsheet)) then return -1;
|
||||||
|
for i := 0 to FTabItems.length()-1 do
|
||||||
|
begin
|
||||||
|
if FTabItems[i].PageSheet = page then return -1;
|
||||||
|
end
|
||||||
|
if page then
|
||||||
|
cp := page.Caption;
|
||||||
|
it := CreateTableItem(cp);
|
||||||
|
FTabItems.Push(it);
|
||||||
|
if FTabItems.length()>1 then
|
||||||
|
begin
|
||||||
|
if page then
|
||||||
|
begin
|
||||||
|
page.visible := false;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it.PageSheet := Page;
|
||||||
|
if FCurrentid=-1 then
|
||||||
|
begin
|
||||||
|
setselidx(0);
|
||||||
|
end
|
||||||
|
end
|
||||||
public
|
public
|
||||||
function getsheetrect(); //获得sheet
|
function getsheetrect(); //获得sheet
|
||||||
begin
|
begin
|
||||||
|
|
@ -409,8 +393,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end
|
end
|
||||||
function create(aowner);
|
function create(aowner);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
end
|
end
|
||||||
function AfterConstruction();override;
|
function AfterConstruction();override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -426,13 +409,25 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
FPrevid := -1;
|
FPrevid := -1;
|
||||||
FTabItems := new tnumindexarray();
|
FTabItems := new tnumindexarray();
|
||||||
end
|
end
|
||||||
|
function ControlAppended(AControl);override;
|
||||||
|
begin
|
||||||
|
if not(AControl is class(tcustomtabsheet)) then return;
|
||||||
|
addtabitem(AControl);
|
||||||
|
end
|
||||||
|
function ControlDeleted(AControl);override;
|
||||||
|
begin
|
||||||
|
if not(AControl is class(tcustomtabsheet)) then return;
|
||||||
|
id := GetPageID(AControl);
|
||||||
|
RemovePageTab(id);
|
||||||
|
//fcoolbands.deleteitem(AControl,true);
|
||||||
|
end
|
||||||
Function SetCurSel(id); //设置当前序号
|
Function SetCurSel(id); //设置当前序号
|
||||||
begin
|
begin
|
||||||
if id is class(tcustomtabsheet) then
|
if id is class(tcustomtabsheet) then
|
||||||
begin
|
begin
|
||||||
return SetCurSel(GetPageID(id));
|
return SetCurSel(GetPageID(id));
|
||||||
end
|
end
|
||||||
if ifnumber(id) then
|
if ifnumber(id) and id>=0 then
|
||||||
begin
|
begin
|
||||||
iid := integer(id);
|
iid := integer(id);
|
||||||
setselidx(iid);
|
setselidx(iid);
|
||||||
|
|
@ -474,20 +469,21 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if onrclick and (mb = mbRight) then
|
if onrclick and (mb = mbRight) then
|
||||||
begin
|
begin
|
||||||
CallMessgeFunction(onrclick,o,e);
|
CallMessgeFunction(onrclick,o,e);
|
||||||
end
|
end
|
||||||
|
return ;
|
||||||
end
|
end
|
||||||
//
|
//
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function doonSelChange(o,e);virtual;
|
function doonSelChange(o,e);virtual;
|
||||||
begin
|
begin
|
||||||
CallMessgeFunction(OnSelChange,o,e);
|
CallMessgeFunction(FOnSelChanged,o,e);
|
||||||
end
|
end
|
||||||
function doonSelChanging(o,e);virtual;
|
function doonSelChanging(o,e);virtual;
|
||||||
begin
|
begin
|
||||||
CallMessgeFunction(OnSelChanging,o,e);
|
CallMessgeFunction(fOnSelChanging,o,e);
|
||||||
end
|
end
|
||||||
function TabRect(AIndex: Integer);
|
function TabRect(AIndex: Integer); //获取区域
|
||||||
begin
|
begin
|
||||||
r := FTabRects[AIndex];
|
r := FTabRects[AIndex];
|
||||||
if r then return r;
|
if r then return r;
|
||||||
|
|
@ -496,14 +492,9 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
function GetTabText(AIndex);//获得caption
|
function GetTabText(AIndex);//获得caption
|
||||||
begin
|
begin
|
||||||
r := "";
|
r := "";
|
||||||
if AIndex<FTabItems.Count and AIndex>0 then return FTabItems[AIndex].Caption;
|
if AIndex<FTabItems.length() and AIndex>0 then return FTabItems[AIndex].Caption;
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function IsContainer(cd);override;//是否容纳
|
|
||||||
begin
|
|
||||||
if cd is class(tcustomtabsheet) then return true;
|
|
||||||
return false;
|
|
||||||
end
|
|
||||||
function GetPageID(page);//获得page序号
|
function GetPageID(page);//获得page序号
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -528,9 +519,9 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
for i := 0 to FTabItems.length()-1 do
|
for i := 0 to FTabItems.length()-1 do
|
||||||
begin
|
begin
|
||||||
it := FTabItems[i];
|
it := FTabItems[i];
|
||||||
if it and it.PageSheet then
|
pg := it.PageSheet;
|
||||||
|
if it and pg then
|
||||||
begin
|
begin
|
||||||
pg := it.PageSheet;
|
|
||||||
if i=FCurrentid then
|
if i=FCurrentid then
|
||||||
begin
|
begin
|
||||||
pg.Visible := true;
|
pg.Visible := true;
|
||||||
|
|
@ -543,109 +534,12 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
rc[2]-=2;
|
rc[2]-=2;
|
||||||
rc[3]-=2;
|
rc[3]-=2;
|
||||||
end
|
end
|
||||||
pg.SetBoundsrect(rc);
|
pg.SetBoundsrect(rc);
|
||||||
end else
|
end else
|
||||||
pg.Visible := false;
|
pg.Visible := false;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function RemovePageTab(id);//移除sheet
|
|
||||||
begin
|
|
||||||
if not(id>=0) then return ;
|
|
||||||
FTabItems.splice(id,1);
|
|
||||||
if id = FCurrentid then
|
|
||||||
begin
|
|
||||||
if id = 0 then
|
|
||||||
begin
|
|
||||||
if FTabItems.length()=0 then
|
|
||||||
begin
|
|
||||||
FCurrentid := -1;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return setselidx(id-1);
|
|
||||||
end else
|
|
||||||
if id<FCurrentid then
|
|
||||||
begin
|
|
||||||
FCurrentid--;
|
|
||||||
end
|
|
||||||
CalcTabs();
|
|
||||||
InvalidateRect(nil,false);
|
|
||||||
end
|
|
||||||
function RemovePage(i);//移除sheet
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明)移除page %%
|
|
||||||
@param(i)(integer) page序号 %%;
|
|
||||||
**}
|
|
||||||
ii := -1;
|
|
||||||
if ifnumber(i) then ii := i;
|
|
||||||
else
|
|
||||||
ii := GetPageID(i);
|
|
||||||
if ii<0 or ii>=FTabItems.length() then return ;
|
|
||||||
item := FTabItems[ii];
|
|
||||||
if ifobj(item) then
|
|
||||||
begin
|
|
||||||
pg := item.PageSheet;
|
|
||||||
if pg then pg.parent := nil;
|
|
||||||
end
|
|
||||||
//setselidx(0); //移除
|
|
||||||
end
|
|
||||||
function addcontrol(page);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明) 添加控件 %%
|
|
||||||
@param(page)(tcustomtabsheet) sheet;
|
|
||||||
**}
|
|
||||||
if not(page is class(tcustomtabsheet)) then return -1;
|
|
||||||
add := true;
|
|
||||||
for i := 0 to Controls.count-1 do
|
|
||||||
begin
|
|
||||||
if Controls[i]=page then add := false;
|
|
||||||
end
|
|
||||||
if add then
|
|
||||||
begin
|
|
||||||
page.Visible := false;
|
|
||||||
page.parent := self;
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function addtabitem(page);//添加sheet
|
|
||||||
begin
|
|
||||||
if not(page is class(tcustomtabsheet)) then return -1;
|
|
||||||
add := true;
|
|
||||||
for i := 0 to FTabItems.length()-1 do
|
|
||||||
begin
|
|
||||||
if FTabItems[i].PageSheet = page then add := false;
|
|
||||||
end
|
|
||||||
add1 := false;
|
|
||||||
for i := 0 to Controls.count-1 do
|
|
||||||
begin
|
|
||||||
if Controls[i]=page then add1 := true;
|
|
||||||
end
|
|
||||||
if add and add1 then
|
|
||||||
begin
|
|
||||||
it := CreateTableItem(page.caption);
|
|
||||||
FTabItems.Push(it);
|
|
||||||
if FTabItems.length()>1 then page.visible := false;
|
|
||||||
it.PageSheet := Page;
|
|
||||||
if {HandleAllocated() and} FCurrentid=-1 then
|
|
||||||
begin
|
|
||||||
setselidx(0);
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function InitializeWnd();override;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
end
|
|
||||||
function AppendPage(page);
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明)添加pagesheet %%
|
|
||||||
@param(page)(tcustomtabsheet)sheet %%;
|
|
||||||
**}
|
|
||||||
if not(page is class(tcustomtabsheet)) then return -1;
|
|
||||||
addcontrol(page);
|
|
||||||
end
|
|
||||||
function SetTabText(i,Value);
|
function SetTabText(i,Value);
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -671,22 +565,23 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
{**
|
{**
|
||||||
@explan(说明) 修改标签的次序 %%
|
@explan(说明) 修改标签的次序 %%
|
||||||
@param(AIndex)(integer) 位置 %%
|
@param(AIndex)(integer) 位置 %%
|
||||||
@param(AIndexnew)(integer) 新位置 %%
|
@param(AIndexnew)(integer) 新位置 %%
|
||||||
|
|
||||||
**}
|
**}
|
||||||
if (AIndex<>AIndexnew) and (AIndex>=0) and
|
if (AIndex<>AIndexnew) and (AIndex>=0) and
|
||||||
(AIndex<FTabItems.length()) and (AIndexnew>=0) and (AIndexnew<FTabItems.length()) then
|
(AIndex<FTabItems.length()) and (AIndexnew>=0) and
|
||||||
|
(AIndexnew<FTabItems.length()) then
|
||||||
begin
|
begin
|
||||||
FTabItems(AIndex,AIndexnew);
|
FTabItems.swap(AIndex,AIndexnew);
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Recycling();override;
|
function Recycling();override;
|
||||||
begin
|
begin
|
||||||
FTabItems.splice(0,FTabItems.length());
|
FOnSelChanged := nil;
|
||||||
inherited;
|
FOnSelChanging := nil;
|
||||||
|
FTabItems.splice(0,nil);
|
||||||
|
inherited;
|
||||||
end
|
end
|
||||||
{**
|
{**
|
||||||
@param(cursel)(integer) 当前选中序号 %%
|
@param(cursel)(integer) 当前选中序号 %%
|
||||||
|
|
@ -696,14 +591,47 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
@param(Onrclcik)(function[tcustompagecontrol,tuieventbase]) 右键点击 %%
|
@param(Onrclcik)(function[tcustompagecontrol,tuieventbase]) 右键点击 %%
|
||||||
**}
|
**}
|
||||||
property cursel:lazyinteger read FCurrentid write SetCurSel;
|
property cursel:lazyinteger read FCurrentid write SetCurSel;
|
||||||
property OnSelChange:eventhandler read FOnSelChange write FOnSelChange;
|
property OnSelChanged:eventhandler read FOnSelChanged write FOnSelChanged;
|
||||||
property OnSelChanging:eventhandler read FOnSelChanging write FOnSelChanging;
|
property OnSelChanging:eventhandler read FOnSelChanging write FOnSelChanging;
|
||||||
//property onrclick:eventhandler read Fonrclick write Fonrclick;
|
|
||||||
property TabCount read GetTabCount;
|
property TabCount read GetTabCount;
|
||||||
property TabPosition:tabalign read FTabPosition write SetTabPosition;
|
property TabPosition:tabalign read FTabPosition write SetTabPosition;
|
||||||
end
|
end
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
type tcustomtabitem = class() //
|
||||||
|
{**
|
||||||
|
@explan(说明)tab控件标签对象 %%
|
||||||
|
**}
|
||||||
|
private
|
||||||
|
FPageCtrl;
|
||||||
|
FCaption;
|
||||||
|
FVisible;
|
||||||
|
FPageSheet;
|
||||||
|
function SetVisible(v);//设置可见
|
||||||
|
begin
|
||||||
|
nv := v?true:false;
|
||||||
|
if nv<>FVisible then
|
||||||
|
begin
|
||||||
|
FVisible := v;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function SetCaption(s);//设置标签
|
||||||
|
begin
|
||||||
|
if ifstring(s) and s<>FCaption then
|
||||||
|
begin
|
||||||
|
FCaption := s;
|
||||||
|
psztext := FCaption;
|
||||||
|
if PageSheet is class(tcustomtabsheet) then PageSheet.Caption := s;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
public
|
||||||
|
function Create();//构造
|
||||||
|
begin
|
||||||
|
FVisible:= true;
|
||||||
|
FCaption := "";
|
||||||
|
end
|
||||||
|
property Caption read FCaption write SetCaption;
|
||||||
|
property PageSheet read FPageSheet Write FPageSheet;
|
||||||
|
end
|
||||||
initialization
|
initialization
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
@ -3646,7 +3646,8 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
property ItemCount read GetItemCount;
|
property ItemCount read GetItemCount;
|
||||||
property Multisel:bool read FMultisel write SetMultisel;
|
property Multisel:bool read FMultisel write SetMultisel;
|
||||||
property checkbox:bool read fcheckbox write setcheckbox;
|
property checkbox:bool read fcheckbox write setcheckbox;
|
||||||
property onSelectionChange:eventhandler read FselectionChange write FselectionChange;
|
property onSelectionChange read FselectionChange write FselectionChange;
|
||||||
|
property onSelchanged:eventhandler read FselectionChange write FselectionChange;
|
||||||
property Items:strings read GetData write setData;
|
property Items:strings read GetData write setData;
|
||||||
protected
|
protected
|
||||||
function CheckListItems(s);
|
function CheckListItems(s);
|
||||||
|
|
@ -4081,7 +4082,7 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
||||||
FListBox.Border := true;
|
FListBox.Border := true;
|
||||||
FListBox.Visible := false;
|
FListBox.Visible := false;
|
||||||
FListBox.WsPopUp := true;
|
FListBox.WsPopUp := true;
|
||||||
FListBox.onselectionchange := function(o,e);
|
FListBox.onselchanged := function(o,e);
|
||||||
begin
|
begin
|
||||||
if feditischanging then return ;
|
if feditischanging then return ;
|
||||||
r := getCurrentItemText();
|
r := getCurrentItemText();
|
||||||
|
|
@ -5796,10 +5797,6 @@ type tcustomprogressbar=class(TCustomControl)
|
||||||
FbarColor:=0xD77800;
|
FbarColor:=0xD77800;
|
||||||
color:=0xf0f0f0;
|
color:=0xf0f0f0;
|
||||||
end
|
end
|
||||||
function isContainer(cd);override;
|
|
||||||
begin
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
function paint();override;
|
function paint();override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue