parent
0262217ded
commit
39d57baf2e
|
|
@ -10,7 +10,7 @@ type tcustomtabitem = class() //TTCITEMA
|
||||||
FCaption;
|
FCaption;
|
||||||
FVisible;
|
FVisible;
|
||||||
FPageSheet;
|
FPageSheet;
|
||||||
function SetVisible(v);
|
function SetVisible(v);//设置可见
|
||||||
begin
|
begin
|
||||||
nv := v?true:false;
|
nv := v?true:false;
|
||||||
if nv<>FVisible then
|
if nv<>FVisible then
|
||||||
|
|
@ -18,7 +18,7 @@ type tcustomtabitem = class() //TTCITEMA
|
||||||
FVisible := v;
|
FVisible := v;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SetCaption(s);
|
function SetCaption(s);//设置标签
|
||||||
begin
|
begin
|
||||||
if ifstring(s) and s<>FCaption then
|
if ifstring(s) and s<>FCaption then
|
||||||
begin
|
begin
|
||||||
|
|
@ -28,14 +28,14 @@ type tcustomtabitem = class() //TTCITEMA
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
function Create();
|
function Create();//构造
|
||||||
begin
|
begin
|
||||||
FVisible:= true;
|
FVisible:= true;
|
||||||
end
|
end
|
||||||
property Caption read FCaption write SetCaption;
|
property Caption read FCaption write SetCaption;
|
||||||
property PageSheet read FPageSheet Write FPageSheet;
|
property PageSheet read FPageSheet Write FPageSheet;
|
||||||
end
|
end
|
||||||
type tcustomtabsheet = class(TCustomControl)
|
type tcustomtabsheet = class(TCustomControl) //控件页面
|
||||||
{**
|
{**
|
||||||
@explan(说明)page控件页面 %%
|
@explan(说明)page控件页面 %%
|
||||||
**}
|
**}
|
||||||
|
|
@ -51,7 +51,7 @@ type tcustomtabsheet = class(TCustomControl)
|
||||||
Parent.SetTabText(id,s);
|
Parent.SetTabText(id,s);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SetParent(p);override;
|
function SetParent(p);override; //设置父窗口
|
||||||
begin
|
begin
|
||||||
if (P is class(tcustompagecontrol) ) and parent<>p then
|
if (P is class(tcustompagecontrol) ) and parent<>p then
|
||||||
begin
|
begin
|
||||||
|
|
@ -61,7 +61,7 @@ type tcustomtabsheet = class(TCustomControl)
|
||||||
oldparent.RemovePage(self);
|
oldparent.RemovePage(self);
|
||||||
end
|
end
|
||||||
inherited;
|
inherited;
|
||||||
parent.addtabitem(self);
|
parent.addtabitem(self(true));
|
||||||
end else
|
end else
|
||||||
if not(p is class(TWincontrol)) then
|
if not(p is class(TWincontrol)) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -74,15 +74,15 @@ type tcustomtabsheet = class(TCustomControl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
function paint();override;
|
function paint();override; //设计器模式下绘制网格
|
||||||
begin
|
begin
|
||||||
drawdesigninggrid();
|
drawdesigninggrid();
|
||||||
end
|
end
|
||||||
function DesigningMove();override;
|
function DesigningMove();override;//移动
|
||||||
begin
|
begin
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
function DesigningSizer();override;
|
function DesigningSizer();override;//调整大小
|
||||||
begin
|
begin
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
|
|
@ -91,7 +91,6 @@ type tcustomtabsheet = class(TCustomControl)
|
||||||
inherited;
|
inherited;
|
||||||
Caption := "tab";
|
Caption := "tab";
|
||||||
Visible := false;
|
Visible := false;
|
||||||
FTabVisible := True;
|
|
||||||
end
|
end
|
||||||
function CreateParams(p);override;
|
function CreateParams(p);override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -101,13 +100,12 @@ type tcustomtabsheet = class(TCustomControl)
|
||||||
end
|
end
|
||||||
type tcustompagecontrol = class(TCustomControl)
|
type tcustompagecontrol = class(TCustomControl)
|
||||||
private
|
private
|
||||||
FirstViewIndex;
|
FirstViewIndex; //第一个展示的序号
|
||||||
FCurrentid;
|
FCurrentid;
|
||||||
FPrevid;
|
FPrevid;
|
||||||
FTabItems; //
|
FTabItems; //
|
||||||
|
|
||||||
FOnSelChange;
|
FOnSelChange;
|
||||||
FOnSelChanging;
|
FOnSelChanging; //正在改变
|
||||||
//FOnrclick;
|
//FOnrclick;
|
||||||
FTabPosition;
|
FTabPosition;
|
||||||
FTabHeight;
|
FTabHeight;
|
||||||
|
|
@ -298,15 +296,21 @@ 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
|
||||||
|
begin
|
||||||
|
e := new tuieventbase(0,FPrevid,FCurrentid,0); //m,w,l,h
|
||||||
|
doonSelChanging(self(true),e);
|
||||||
|
if e.skip then return ;
|
||||||
|
end
|
||||||
FPrevid := FCurrentid;
|
FPrevid := FCurrentid;
|
||||||
FCurrentid := id;
|
FCurrentid := id;
|
||||||
InsureIdxVisible(id);
|
InsureIdxVisible(id);
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
DoControlAlign();
|
DoControlAlign();
|
||||||
if OnSelChanging then
|
|
||||||
doonSelChanging(self(true),new tuieventbase(0,0,0,0));
|
|
||||||
if OnSelChange then
|
if OnSelChange then
|
||||||
doonSelChange(self(true),new tuieventbase(0,0,0,0));
|
begin
|
||||||
|
doonSelChange(self(true),new tuieventbase(0,FPrevid,FCurrentid,0));
|
||||||
|
end
|
||||||
end else
|
end else
|
||||||
if FTabItems.length()=0 then
|
if FTabItems.length()=0 then
|
||||||
begin
|
begin
|
||||||
|
|
@ -422,8 +426,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
FPrevid := -1;
|
FPrevid := -1;
|
||||||
FTabItems := new tnumindexarray();
|
FTabItems := new tnumindexarray();
|
||||||
end
|
end
|
||||||
|
Function SetCurSel(id); //设置当前序号
|
||||||
Function SetCurSel(id);
|
|
||||||
begin
|
begin
|
||||||
if id is class(tcustomtabsheet) then
|
if id is class(tcustomtabsheet) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -435,24 +438,23 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
setselidx(iid);
|
setselidx(iid);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function paint();override; //绘制
|
function paint();override; //绘制
|
||||||
begin
|
begin
|
||||||
PaintTabs();
|
PaintTabs();
|
||||||
PaintScroll();
|
PaintScroll();
|
||||||
end
|
end
|
||||||
function MouseUp(o,e);override;
|
function MouseUp(o,e);override;//鼠标弹起
|
||||||
begin
|
begin
|
||||||
ps := e.pos();
|
ps := e.pos();
|
||||||
if e.button()=mbRight then return ;
|
mb := e.button();
|
||||||
if FScrollBtnRect and pointinrect(ps,fnextrect) then
|
//if mb=mbRight then return ;
|
||||||
|
if (mb=mbLeft) and FScrollBtnRect and pointinrect(ps,fnextrect) then
|
||||||
begin
|
begin
|
||||||
if e.Button() = mbLeft then
|
if e.Button() = mbLeft then
|
||||||
ScrollNext();
|
ScrollNext();
|
||||||
return ;
|
return ;
|
||||||
end else
|
end else
|
||||||
if FScrollBtnRect and pointinrect(ps,Fprevrect) then
|
if (mb=mbLeft) and FScrollBtnRect and pointinrect(ps,Fprevrect) then
|
||||||
begin
|
begin
|
||||||
if e.Button() = mbLeft then
|
if e.Button() = mbLeft then
|
||||||
scrollprev();
|
scrollprev();
|
||||||
|
|
@ -465,17 +467,16 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if v and pointinrect(ps,v) then
|
if v and pointinrect(ps,v) then
|
||||||
begin
|
begin
|
||||||
setselidx(i);
|
setselidx(i);
|
||||||
if e.Button() = mbLeft then
|
if Onclick and (mb = mbLeft) then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
CallMessgeFunction(Onclick,o,e);
|
CallMessgeFunction(Onclick,o,e);
|
||||||
end else
|
end else
|
||||||
if e.Button() = mbRight then
|
if onrclick and (mb = mbRight) then
|
||||||
begin
|
begin
|
||||||
CallMessgeFunction(onrclick,o,e);
|
CallMessgeFunction(onrclick,o,e);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
e.skip := true;
|
//
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function doonSelChange(o,e);virtual;
|
function doonSelChange(o,e);virtual;
|
||||||
|
|
@ -492,18 +493,18 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if r then return r;
|
if r then return r;
|
||||||
return array(0,0,0,0);
|
return array(0,0,0,0);
|
||||||
end
|
end
|
||||||
function GetTabText(AIndex);
|
function GetTabText(AIndex);//获得caption
|
||||||
begin
|
begin
|
||||||
r := "";
|
r := "";
|
||||||
if AIndex<FTabItems.Count and AIndex>0 then return FTabItems[AIndex].Caption;
|
if AIndex<FTabItems.Count and AIndex>0 then return FTabItems[AIndex].Caption;
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function IsContainer(cd);override;
|
function IsContainer(cd);override;//是否容纳
|
||||||
begin
|
begin
|
||||||
if cd is class(tcustomtabsheet) then return true;
|
if cd is class(tcustomtabsheet) then return true;
|
||||||
return false;
|
return false;
|
||||||
end
|
end
|
||||||
function GetPageID(page);
|
function GetPageID(page);//获得page序号
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)获取page的序号 %%
|
@explan(说明)获取page的序号 %%
|
||||||
|
|
@ -521,7 +522,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function DoControlAlign();override;
|
function DoControlAlign();override;//调整位置
|
||||||
begin
|
begin
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
for i := 0 to FTabItems.length()-1 do
|
for i := 0 to FTabItems.length()-1 do
|
||||||
|
|
@ -548,7 +549,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function RemovePageTab(id);
|
function RemovePageTab(id);//移除sheet
|
||||||
begin
|
begin
|
||||||
if not(id>=0) then return ;
|
if not(id>=0) then return ;
|
||||||
FTabItems.splice(id,1);
|
FTabItems.splice(id,1);
|
||||||
|
|
@ -570,7 +571,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
function RemovePage(i);
|
function RemovePage(i);//移除sheet
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
@explan(说明)移除page %%
|
@explan(说明)移除page %%
|
||||||
|
|
@ -636,7 +637,6 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
|
|
||||||
function AppendPage(page);
|
function AppendPage(page);
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
|
||||||
|
|
@ -4048,9 +4048,11 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
||||||
end
|
end
|
||||||
FEdit.onchange := function(o,e);
|
FEdit.onchange := function(o,e);
|
||||||
begin
|
begin
|
||||||
|
if feditischanging then return feditischanging := false;
|
||||||
if not(o.Readonly) then
|
if not(o.Readonly) then
|
||||||
begin
|
begin
|
||||||
feditischanging := true;
|
feditischanging := true;
|
||||||
|
if Foneditchanged then
|
||||||
CallMessgeFunction(Foneditchanged,o,e);
|
CallMessgeFunction(Foneditchanged,o,e);
|
||||||
if FMultisel then return feditischanging:=false;
|
if FMultisel then return feditischanging:=false;
|
||||||
t := o.Text;
|
t := o.Text;
|
||||||
|
|
@ -4083,7 +4085,9 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
||||||
begin
|
begin
|
||||||
if feditischanging then return ;
|
if feditischanging then return ;
|
||||||
r := getCurrentItemText();
|
r := getCurrentItemText();
|
||||||
|
feditischanging := true;
|
||||||
FEdit.Text := r;
|
FEdit.Text := r;
|
||||||
|
feditischanging := false;
|
||||||
ShowDropDown(false);
|
ShowDropDown(false);
|
||||||
CallMessgeFunction(OnSelchanged,self(true),e);
|
CallMessgeFunction(OnSelchanged,self(true),e);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue