diff --git a/designer/udesignerproject.tsf b/designer/udesignerproject.tsf index ca1ad87..96132e4 100644 --- a/designer/udesignerproject.tsf +++ b/designer/udesignerproject.tsf @@ -1533,7 +1533,7 @@ BD141CA912494F502D48D224F45050274A21E03806FF2C7CA7516022D7D000000 WsDlgModalFrame := true; visible := false; Left := 50; - Top := 20; + Top := 120; Width := 1000; height := 900; wspopup := true; diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index 281a817..b4da36c 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -1469,7 +1469,7 @@ type TTslDebuga=class(TCustomControl) begin if FDebughandle then begin - SysTerminate(-1,FDebughandle); + SysTerminate(1,FDebughandle); FDebughandle := 0; Fdebugedwhandle := 0; end end diff --git a/funcext/tvclib/tslvcl.tsf b/funcext/tvclib/tslvcl.tsf index f8dbf5a..18a517a 100644 --- a/funcext/tvclib/tslvcl.tsf +++ b/funcext/tvclib/tslvcl.tsf @@ -21,7 +21,9 @@ unit tslvcl; {$define gdipaint} {$endif} interface -uses utslvclconstant,utslvclbase,utslvclauxiliary,cstructurelib,utslvclmemstruct,utslvclevent,UVCPropertyTypesPersistence,utslvclgdi,utslvclaction,utslvclmenu,utslvclstdctl,utslvclgrid,utslvcltree; +uses utslvclconstant,utslvclbase,utslvclauxiliary,cstructurelib,utslvclmemstruct,utslvclevent, + UVCPropertyTypesPersistence,utslvclgdi,utslvclaction,utslvclmenu,utslvclstdctl,utslvclpage,utslvcldlg, + utslvclgrid,utslvcltree; function initializeapplication(); //获得app对象 function RegisterComponentType(n,typ); //注册控件,便于通过控件名称构造控件 function GetAndDispatchMessageA(hwnd,minm,maxm); //win32 分发消息 @@ -1541,431 +1543,55 @@ type TDCreatePanel=class(TpanelForm) end //按钮 -type tbtn = class(TCustomControl) - {** +type tbtn = class(tcustombtn) +{** @explan(说明) 普通按钮 %% - **} - function Create(aowner); + **} + function create(AOwner); begin inherited; - Caption:="button"; - Left:=0; - Top:=0; - Width:=94; - Height:=31; - Color := _wapi.GetSysColor(COLOR_MENUBAR); end - function click();virtual; - begin - {** - @explan(说明)模拟点击按钮一下的操作%% - **} - if handleAllocated() then _send_(BM_CLICK,0,0); - end - function BMCLICK(o,e):BM_CLICK;virtual; - begin - if csDesigning in ComponentState then return ; - if FdoingClick then return ; - FdoingClick := true; - //try - if Action and Action.Execute() then - begin - - end else - calldatafunction(onClick,self(true),e); - // finally - FdoingClick := false; - // end; - end - function WMKEYDOWN(o,e);override; - begin - inherited; - case e.CharCode of - 13 : - begin - click(); - end - - end ; - end - function MouseDown(o,e);override; - begin - if csDesigning in ComponentState then return ; - if not Fbtnstate then - begin - Fbtnstate := true; - InvalidateRect(nil,false); - end - inherited; - end - function WMLBUTTONUP(o,e):WM_LBUTTONUP;override; - begin - if csDesigning in ComponentState then return ; - click(); - if Fbtnstate then - begin - Fbtnstate := 0; - InvalidateRect(nil,false); - end - end - function WMRBUTTONUP(o,e):WMRBUTTONUP;override; - begin - if csDesigning in ComponentState then return ; - click(); - if Fbtnstate then - begin - Fbtnstate := 0; - InvalidateRect(nil,false); - end - end - function dosetfocus(o,e);override; - begin - {** - @explan(说明) 控件获得焦点 %% - @param(o)(TWinControl) 控件自身 %% - @Param(e)(tuieventbase) 消息对象 %% - **} - inherited; - FBtnfocused := true; - InvalidateRect(nil,false); - end - function dokillfocus(o,e);override; - begin - {** - @explan(说明) 控件失去焦点 %% - @param(o)(TWinControl) 控件自身 %% - @Param(e)(tuieventbase) 消息对象 %% - **} - inherited; - FBtnfocused := false; - InvalidateRect(nil,false); - end - - function paint();override; - begin - if Fbtnstate then - begin - PaintMouseDown(); - end else - if FBtnfocused then - begin - paintfocus(self.Canvas,self.ClientRect); - end - rec := GetBtntextRect(); - if not ifarray(rec) then return ; - if not (rec[2]>rec[0] and rec[3]>rec[1]) then return ; - { - AL9_DEFAULT := 0;//0 - AL9_TOPLEFT := 1;//1 - AL9_TOPCENTER := 2 ;//2 - AL9_TOPRIGHT := 3;//3 - AL9_CENTERLEFT := 4 ;//4 - AL9_CENTER := 5 ;//5 - AL9_CENTERRIGHT := 6;//6 - AL9_BOTTOMLEFT := 7 ;//7 - AL9_BOTTOMCENTER := 8;//8 - AL9_BOTTOMRIGHT := 9;//9 - } - df := 0; - case FtextPosition of - 1: df := DT_LEFT; - 2: df := DT_CENTER; - 3: df := DT_RIGHT - 4: df := DT_LEFT .| DT_VCENTER; - 6: df := DT_RIGHT .| DT_VCENTER; - 7: d := DT_BOTTOM .| DT_LEFT; - 8: df := DT_BOTTOM .|DT_CENTER; - 9: df := DT_BOTTOM .| DT_RIGHT; - else - begin - df := DT_CENTER .| DT_VCENTER .| DT_SINGLELINE; - end - end ; - dc := Canvas; - c := caption; - - if ifstring(c) and c then - begin - dc.font := font; - flg := 0; - if not Enabled then - begin - bc := dc.font.color; - dc.font.color := 0xc0c0c0; - flg := 1; - end - dc.drawtext(c,rec,df); - if flg then - begin - dc.font.color := bc; - end - end - - end - function FontChanged(o);override; - begin - inherited; - InvalidateRect(nil,false); - end - function Recycling();override; - begin - inherited; - FonSetFocus := nil; - FonKillFocus := nil; - end - property textPos:AlignStyle9 read FtextPosition write setTextPosition; - property pushLike:bool read FpushLike write setPushLike; - property multiLine:bool read FmultiLine write setMultiLine; - {** - @param(textPos)(member of TAlignStyle9) 文本位置%% - @param(pushLike)(bool)是否为普通按钮外观%% - @param(multiLine)(bool)文本是否为多行显示%% - **} function publishs();override; begin return array("name","action","left","top","width","height", "align","anchors","caption","font","enabled","visible","bkbitmap","color","tabstop","onclick","onmousemove"); end - protected - function SetEnabled(v);override; - begin - nv := v?true:false; - if nv<>Enabled then - begin - inherited; - if HandleAllocated() then - InvalidateRect(nil,false); - end - end - function RealSetText(s);override; - begin - bs := caption; - inherited; - if bs = caption then return ; - InvalidateRect(nil,false); - end - function PaintMouseDown();virtual; - begin - r := ClientRect; - dc := Canvas; - bps := dc.pen.style; - {dc.pen.color := rgb(150,200,230); - dc.pen.width := 1; - dc.pen.style := PS_SOLID; - drawrc(dc,r,1);} - paintfocus(dc,r); - dc.pen.style := PS_DOT; - dc.pen.color := rgb(170,220,250); - drawrc(dc,r,4); - dc.pen.style := bps; - end - private - function paintfocus(dc,r); - begin - dc.pen.color := rgb(150,200,230); - dc.pen.width := 1; - dc.pen.style := PS_SOLID; - drawrc(dc,r,1); - end - function drawrc(dc,r,n); - begin - r[0] += n; - r[2] -= n; - r[1] += n; - r[3] -= n; - dc.moveto(r[array(0,1)]); - dc.LineTo(r[array(2,1)]); - dc.LineTo(r[array(2,3)]); - dc.LineTo(r[array(1,3)]); - dc.LineTo(r[array(0,1)]); - end - function setPushLike(); - begin - - end - function setMultiLine(); - begin - - end - function GetBtnTextRect();virtual; - begin - return ClientRect; - end - function setTextPosition(n); - begin - if not ifnumber(n) or n<0 or n>9 then - n:=0; - else - n:=integer(n); - if FtextPosition=n then return ; - FtextPosition:=n; - InvalidateRect(nil,false); - end - private - FBtnfocused; - FdoingClick; - FpushLike; - FmultiLine; - FtextPosition; - Fbtnstate; + end -type tcheckbtn=class(tbtn) +type tcheckbtn = class(tcustomcheckbtn) {** @explan(说明) 复选框 %% **} - //BM_SETCHECK - public - function create(aowner);override; + function create(AOwner); begin inherited; - FcheckState:=0; - FleftText:=0; - end - function click();override; - begin - FcheckState := not FcheckState; - _send_(BM_SETCHECK,FcheckState,0 ); - inherited; end - function paint();override; - begin - inherited; - drawchekd(FCheckRect); - end - function BMSETCHECK(o,e):BM_SETCHECK;virtual; - begin - FcheckState := e.wparam; - InvalidateRect(nil,false); - end - property checked:bool read FcheckState write setChecked; - property leftText:bool read FleftText write setLeftText; function publishs();override; begin return array("name","left","top","width","height", "caption","anchors","enabled","color","visible","font", "textpos","checked","lefttext","tabstop","onclick","onmousemove","onmousedown","onmouseup"); end - {** - @param(checked)(integer)勾选状态: - 0:未选中。 - 1:选中。 - @param(leftText)(bool)文本是否在左%% - **} - private - FleftText; - FcheckState; - FCheckRect; - private - function drawchekd(r);virtual; - begin - if r then - begin - dc := Canvas; - dc.pen.style := PS_SOLID; - dc.brush.color := rgb(200,0,0); - dc.Draw("framecontrol",array(r[0:1],r[2:3]),DFC_BUTTON,(checked)?DFCS_CHECKED:DFCS_BUTTONCHECK); - end - end - function setChecked(v);virtual; - begin - nv := v?true:false; - if nv<>FcheckState then - begin - FcheckState := nv; - if handleAllocated() then _send_(BM_SETCHECK,FcheckState,0); - end - end - function setLeftText(v); - begin - nv := v?true:false; - if FleftText<>nv then - begin - FleftText := nv; - InvalidateRect(nil,false); - end - end - function GetBtnTextRect();virtual; - begin - r := ClientRect; - h := r[3]-r[1]; - dh := integer( (h-16)/2)+1; - if FleftText then - begin - FCheckRect := array(r[2]-18,r[1]+dh,r[2]-2,r[3]-dh); - r[2] -=20; - end else - begin - FCheckRect := array(r[0]+2,r[1]+dh,r[0]+18,r[3]-dh); - r[0] +=20; - end - return r; - end -end -type tradiobtn = class(tcheckbtn) + +end +type tradiobtn = class(tcustomradiobtn) {** @explan(说明)radiobtn单选按钮控件 **} - public - function create(owner);override; + function create(AOwner); begin inherited; - end - function InitializeWnd();override; + end + function publishs();override; begin - inherited; - ck := checked; - if ck then - _send_(BM_SETCHECK,ck,0); + return array("name","left","top","width","height", + "caption","anchors","enabled","color","visible","font", + "textpos","checked","lefttext","tabstop","onclick","onmousemove","onmousedown","onmouseup"); end - function click();override; - begin - if checked then - begin - _send_(BM_CLICK,0,0); - end else - inherited; - end - function BMSETCHECK(o,e):BM_SETCHECK;override; - begin - t := e.wparam; - inherited; - if t then - begin - p := parent ; - ctls := p.Controls; - for i := 0 to ctls.count-1 do - begin - ci := ctls[i]; - if ci is class(tradiobtn) then - begin - if ci=self(true) then continue; - if ci.checked then - begin - ci.checked := false; - end - end - end - end - end - private - function drawchekd(r);override; - begin - if r then - begin - dc := Canvas; - dc.pen.style := PS_SOLID; - dc.brush.color := rgb(200,0,0); - dc.Draw("framecontrol",array(r[0:1],r[2:3]),DFC_BUTTON,DFCS_BUTTONRADIO); - if checked then - begin - r2 := array(r[0:1]+3,r[2:3]-3); - dc.brush.color := 0; - dc.draw("ellipse",r2); - end - end - end -end - type TPopMenuBtn=class(TBtn) + +end + +type TPopMenuBtn=class(TBtn) {** @ignore(忽略) %% @explan(说明) 弹出菜单的按钮 %% @@ -2042,57 +1668,42 @@ end //edit type tedit = class(tcustomedit) + {** + @explan(说明) 单行文本编辑框类 %% + **} function create(AOwner);override; begin inherited; end + function publishs();override; + begin + return array("name","align","anchors","border","font","enabled","popupmenu","visible","height","width","left","top","text","placeholder" + ,"readonly","limitlength","linewrap","tabstop","onmousemove","onpopupmenu","onmousedown","onmouseup","onkeyup" + ,"onkeydown","onkeypress","onmaxtext","onkillfocus","onsetfocus","onchange"); + end end -type tpassword = class(tedit) +type tpassword = class(tcustompassword) {** @explan(说明) 密码编辑框类 %% **} - private - function SetPassWordChar(v); - begin - return ExecuteCommand("ecpasswordchar",v); - end - function getPassWordChar(); - begin - return ExecuteCommand("ecpasswordchar"); - end - public - function create(owner);override; + function create(AOwner);override; begin inherited; - ExecuteCommand("ecmarked",true); - Left := 10; - Top := 10; - Width := 80; - Height := 25; - caption := "tpassword"; end - function KeyDown(o,e);override; + function publishs();override; begin - if ( ssCtrl in e.shiftstate) and (ord("C")=e.CharCode) then - begin - return ; - end - inherited; - end - property PassWordChar:string read getPassWordChar write SetPassWordChar; - function publishs();override; - begin - return array("name", - "align","anchors","font", - "popupmenu","visible", - "height","width","left","top", - "text","placeholder","readonly","limitlength","tabstop", - "passwordchar","onmousemove","onpopupmenu", - "onmousedown","onmouseup", - "onkeyup","onkeydown","onkeypress", - "onmaxtext","onkillfocus","onsetfocus","onchange"); - end - end + return array("name", + "align","anchors","font", + "popupmenu","visible", + "height","width","left","top", + "text","placeholder","readonly","limitlength","tabstop", + "passwordchar","onmousemove","onpopupmenu", + "onmousedown","onmouseup", + "onkeyup","onkeydown","onkeypress", + "onmaxtext","onkillfocus","onsetfocus","onchange"); + end +end + type tmemo = class(TSynMemoNorm) uses UTslMemo; {** @@ -2159,7 +1770,7 @@ type tmemo = class(TSynMemoNorm) "height","width","left","top", "text","readonly", "tabspace","onmousewheel","onmousemove","onpopupmenu", - "onmousedown","onmouseup", + "onmousedown","onmouseup","onsetfocus","onkillfocus", "onkeyup","onkeydown","onkeypress", "onchange"); end @@ -2172,93 +1783,22 @@ type tmemo = class(TSynMemoNorm) end //goupbox -type tgroupbox = class(TCustomControl) - {** - @explan(说明) groupbox %% - **} - function create(owner);override; +type tgroupbox = class(tcustomgroupbox) + {** + @explan(说明) groupbox %% + **} + function create(AOwner); begin inherited; - Left := 10; - Top := 10; - Width := 185; - Height := 105; - caption := "group"; - Color := rgb(240,240,240); - FtextPosition := 0; - end - function Paint();override; - begin - c := caption; - if Parent and ParentFont then - begin - ft := Parent.Font; - end else - ft := Font; - wf := ft.width; - hf := ft.height+2; - cvs := Canvas; - cvs.pen.color := rgb(170,170,170); - cvs.pen.width := 1; - cwd := 0; - if c then - begin - cwd := wf*length(c)+1; - end - rc := ClientRect; - hf2 := integer(hf/2); - /////////////////////////////////////// - - cvs.moveto(array(3,hf2)); - cvs.LineTo(array(3,rc[3]-3)); - cvs.LineTo(array(rc[2]-3,rc[3]-3)); - cvs.LineTo(array(rc[2]-3,hf2)); - cvs.LineTo(array(3,hf2)); - /////////////////////////////////////// - ///////////////////////////////////////// - - txpos := 10; - if c then - begin - if cwd<(rc[2]-rc[0]-20) then - begin - case FtextPosition of - 2: - begin - txpos := 10+integer((rc[2]-rc[0]-20-cwd)/2); - end - 3: - begin - txpos := rc[2]-rc[0]-10-cwd; - end - - end ; - - end - cvs.pen.color := Color; - cvs.moveto(array(txpos-1,hf2)); - cvs.LineTo(array(txpos+cwd+1,hf2)); - cvs.textout(c,array(txpos,0)); - end - ///////////////////////////////// end - property textPos:AlignStyle9 read FtextPosition write setTextPosition ; function publishs();override; begin - return array("name","left","top","width","height", - "align","anchors","border","caption","color","enabled","font","visible","textpos","wsdlgmodalframe"); + return array("name","left","top","width","height", + "align","anchors","border","caption","color","enabled","font","visible","textpos","wsdlgmodalframe", + "onsize"); end - private - function setTextPosition(n); - begin - if ( n in array(0,1,2,3)) and n<>FtextPosition then - begin - FtextPosition := n; - InvalidateRect(nil,false); - end - end - FtextPosition; -end +end + type TCheckGroupBox=class(TRadioGroupBox) {** @explan(说明) checkgroupbox %% @@ -2623,10 +2163,23 @@ end //listbox type TListBox = class(TcustomListBox) + {** + @explan(说明) listbox控件 %% + **} function create(AOwner); begin inherited; end + function publishs();override; + begin + return array("name","caption","anchors","align","enabled", + "font","visible","border","color", + "height","width","left","top","items", + "multisel","popupmenu","wsdlgmodalframe", + "onmousedown","onmouseup", + "onselectionchange" + ); + end end type TColorbox=class(TcustomListBox) @@ -2855,11 +2408,21 @@ type TColorCombobox=class(TCustomComboBoxbase) end end type TComboBox = class(TcustomComboBox) - + {** + @explan(说明) comboBox下拉框 %% + **} function create(AOwner); begin inherited; end + function publishs();override; + begin + return array("name","font","border", + "visible","anchors","align","enabled", + "height","width","left","top", + "readonly","itemindex", + "items","oncloseup","ondropdown","onselchanged","oneditchanged","oneditupdate"); + end end //工具栏,状态栏 @@ -2899,153 +2462,59 @@ end type TToolButton = class(TcustomToolButton) + {** + @explan(说明) 工具栏项 %% + **} function create(AOwner); begin inherited; end + function publishs();override; + begin + return array("name","caption","enabled","stylesep","imageid","visible","onclick","popupmenu"); + end end type TToolBar = class( TcustomToolBar) + {** + @explan(说明) 工具栏控件 %% + **} function create(AOwner); begin inherited; end + function publishs();override; + begin + return array("name","align","caption","enabled","font","left","top","width","height", + "visible","imagelist"); + if Align <> alNone then + begin + return array("name","align","caption","enabled","font", + "visible","imagelist"); + end else + return array("name","align","caption","enabled","font","left","top","width","height", + "visible","imagelist"); + end end - -type TStatusBar=class(TCustomControl) +type TStatusBar = class(TcustomStatusBar) {** @explan(说明) 状态栏 %% **} - private - Fitems; - FCwid; - FCHei; - function itemidok(id); - begin - ct := length(Fitems); - return id >= 0 and id0 and wd<1.0001 then - begin - wd *= FCwid; - end - DrawStatItem(cvs,v,array(p,0,p+wd,FCHei)); - p += wd; - if p>FCwid then return; - end - end - if p0)then wd := 100; - Fitems[Length(Fitems)]:= array("text":str,"width":wd); - if HandleAllocated()then - begin - InvalidateRect(nil,false); - end - end - function deleteitem(id); - begin - {** - @explan(说明) 删除项目 %% - @param(id)(integer) 序号 %% - **} - if not(itemidok(id))then return-1; - deleteindex(Fitems,id,true); - if HandleAllocated()then - begin - InValidateRect(nil,false); - end - end - function setitemtext(str,id); - begin - {** - @explan(说明) 修改字段 %% - @param(str)(string) 文本%% - @param(id)(integer) 序号 %% - **} - if not ifstring(str)then return-1; - if not(itemidok(id))then return-1; - Fitems[id,"text"]:= str; - if HandleAllocated()then - begin - InvalidateRect(nil,false); - end - end - property Items:statusitems read Fitems Write SetItems; + end function publishs();override; begin return array("name","caption","enabled","border", "font","visible","items","ondblclick","onmousedown","onmouseup"); end - {** - @param(Items)(array)设置项 ,二维数组包括 text ,width 两个字段 array(("text":"abc","width":200),("text":"part2","width":0.4))%% - **} -end +end + //树控件 type TTreeCtlNode = class( TcustomTreeCtlNode) + {** + @explan(说明) 树结点 %% + **} function create(AOwner); begin inherited; @@ -3053,7 +2522,9 @@ type TTreeCtlNode = class( TcustomTreeCtlNode) end type TTreeCtl = class(TcustomTreeCtl) - + {** + @explan(说明) 树控件 %% + **} function create(AOwner);override; begin inherited; @@ -3434,738 +2905,34 @@ type TTreeView=class(TTreeCtl) **} end //tab控件 -type TTCITEMA=class(tcstructwithcharptr) - {** - @explan(说明)tab控件标签内存对象 %% - **} - private - static SSTRUCT; - function getstruct() - begin - if not SSTRUCT then SSTRUCT := array( - ("mask","int",0), - ("dwstate","int",0), - ("dwstatemask","int",0), - ("psztext","intptr",0), - ("cchtextmax","int",0), - ("iimage","int",0), - ("lparam","intptr",0)); - return SSTRUCT; - end - public - function create(ptr) - begin - inherited create(getstruct(),array("psztext":"cchtextmax"),nil); - end - property mask index "mask" read _getvalue_ write _setvalue_; - property dwstate index "dwstate" read _getvalue_ write _setvalue_; - property dwstatemask index "dwstatemask" read _getvalue_ write _setvalue_; - property psztext index "psztext" read _getvalue_ write _setvalue_; - property cchtextmax index "cchtextmax" read _getvalue_ write _setvalue_; - property iimage index "iimage" read _getvalue_ write _setvalue_; - property lparam index "lparam" read _getvalue_ write _setvalue_; -end - -type TTableItem = 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(TTabSheet) then PageSheet.Caption := s; - end - end - public - function Create(); - begin - inherited create(nil); - FVisible:= true; - end - property Caption read FCaption write SetCaption; - property PageSheet read FPageSheet Write FPageSheet; -end -type TTabSheet = class(TCustomControl) +type TTabSheet = class(tcustomtabsheet) {** @explan(说明)page控件页面 %% **} - private - FImageIndex; - protected - function RealSetText(s);override; + + function create(AOwner); begin inherited; - if ifstring(s) and Parent then - begin - id := parent.GetPageID(self(true)); - Parent.SetTabText(id,s); - end end - function SetParent(p);override; - begin - if (P is class(TPageControl) ) and parent<>p then - begin - oldparent := Parent; - if oldparent then - begin - oldparent.RemovePage(self); - end - inherited; - parent.addtabitem(self); - 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 - function paint();override; - begin - drawdesigninggrid(); - end - function DesigningMove();override; - begin - return false; - end - function DesigningSizer();override; - begin - return false; - end - function create(AOwner);override; - begin - inherited; - Caption := "tab"; - Visible := false; - FTabVisible := True; - end - function CreateParams(p);override; - begin - inherited; - p.exstyle := 0x101; - end function publishs();override; begin return array("name","caption","color","border","wsdlgmodalframe","onsize"); end end -type TPageControl = class(TCustomControl) - private - FirstViewIndex; - FCurrentid; - FPrevid; - FTabItems; // - - FOnSelChange; - FOnSelChanging; - //FOnrclick; - FTabPosition; - FTabHeight; - FTabItemswidth; - FScrollBtnRect; - Fprevrect; - fnextrect; - FTabRects; - FClientarea; - function SetTabPosition(v); - begin - if FTabPosition=v then exit; - if not(v in array(alTop,alBottom,alLeft,alRight)) then exit; - FTabPosition := v; - InvalidateRect(nil,false); - DoControlAlign(); - end - function GetTabCount(); - begin - return FTabItems.length(); - end - function CreateTableItem(cp); - begin - r := new TTableItem(); - r.caption := cp; - return r; - end - function CalcTabs(); //计算区域 - begin - rec := ClientRect; //区域 - ft := font; - fw := ft.width; - fh := ft.height; - FTabHeight := fh+7; - FTabItemswidth := array(); - for i := 0 to FTabItems.length()-1 do - begin - pg := FTabItems[i]; - ta := pg.Caption; - FTabItemswidth[i] := max(20, length(ta)*fw+8 ); - end - FMaxsize := 0; - if FTabPosition in array(alLeft,alRight) then - begin - FTabItemswidth := zeros(length(FTabItemswidth))+maxvalue(FTabItemswidth); - FMaxsize := length(FTabItemswidth)*FTabHeight; - end else - begin - FMaxsize := sum(FTabItemswidth); - end - FClientarea := rec; - FScrollBtnRect := 0; - Fprevrect := 0; - fnextrect := 0; - FTabRects := array(); - case FTabPosition of - alLeft: - begin - if FTabItemswidth then - begin - FClientarea[0] :=rec[0]+FTabItemswidth[0]; - if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then - begin - FScrollBtnRect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]); - Fprevrect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]-FTabHeight); - Fnextrect := array(rec[0],rec[3]-FTabHeight,rec[0]+FTabItemswidth[0],rec[3]); - end else - begin - FirstViewIndex := 0; - end - ybase := 0; - for i,v in FTabItemswidth do - begin - if i>=FirstViewIndex then - begin - FTabRects[i] := array(0,ybase,FTabItemswidth[0],ybase+FTabHeight); - ybase+=FTabHeight; - if xbase>(rec[3]-FTabHeight-FTabHeight) then break; - end - else FTabRects[i] := nil; - end - end - end - alRight: - begin - if FTabItemswidth then - begin - - FClientarea[2] :=rec[2]-FTabItemswidth[0]; - if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then - begin - FScrollBtnRect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]); - Fprevrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]-FTabHeight); - Fnextrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight,rec[2],rec[3]); - end else - FirstViewIndex := 0; - ybase := 0; - for i,v in FTabItemswidth do - begin - if i>=FirstViewIndex then - begin - FTabRects[i] := array(rec[2]-FTabItemswidth[0],ybase,rec[2],ybase+FTabHeight); - ybase+=FTabHeight; - if xbase>(rec[3]-FTabHeight-FTabHeight) then break; - end - else FTabRects[i] := nil; - end - end - end - alTop: - begin - if FTabItemswidth then - begin - - FClientarea[1] :=rec[1]+FTabHeight; - if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then - begin - FScrollBtnRect := array(rec[2]-FTabHeight*2,rec[1],rec[2],rec[1]+FTabHeight); - - Fnextrect := array(rec[2]-FTabHeight,rec[1],rec[2],rec[1]+FTabHeight); - Fprevrect := array(rec[2]-FTabHeight*2,rec[1],rec[2]-FTabHeight,rec[1]+FTabHeight); - end else FirstViewIndex := 0; - xbase := 0; - for i,v in FTabItemswidth do - begin - if i>=FirstViewIndex then - begin - FTabRects[i] := array(xbase,0,xbase+FTabItemswidth[i],FTabHeight); - xbase+=FTabItemswidth[i]; - if xbase>(rec[2]-FTabHeight-FTabHeight) then break; - end else - FTabRects[i] := nil; - end - end - end - alBottom: - begin - if FTabItemswidth then - begin - - FClientarea[3] :=rec[3]-FTabHeight; - if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then - begin - FScrollBtnRect := array(rec[2]-FTabHeight*2,rec[3]-FTabHeight,rec[2],rec[3]); - Fnextrect := array(rec[2]-FTabHeight,rec[3]-FTabHeight,rec[2],rec[3]); - Fprevrect := array(rec[2]-FTabHeight*2,rec[3]-FTabHeight,rec[2]-FTabHeight,rec[3]); - end else FirstViewIndex := 0; - xbase := 0; - for i,v in FTabItemswidth do - begin - if i>=FirstViewIndex then - begin - FTabRects[i] := array(xbase,rec[3]-FTabHeight,xbase+FTabItemswidth[i],rec[3]); - xbase+=FTabItemswidth[i]; - if xbase>(rec[2]-FTabHeight-FTabHeight) then break; - end else - FTabRects[i] := nil; - end - end - end - end - end - function InsureIdxVisible(id); //确保可见 - begin - if FScrollBtnRect and (not FTabRects[id]) then - begin - if id>FirstViewIndex then - begin - while(not FTabRects[min(id+1,(FTabItems.length()-1))]) do - begin - FirstViewIndex++; - CalcTabs(); - end - end else - if id=0 and id0 then - begin - FirstViewIndex-- ; - CalcTabs(); - InvalidateRect(nil,false); - end - end - function scrollnext(); //滚动到上一个 - begin - if FScrollBtnRect and FirstViewIndex0 then return FTabItems[AIndex].Caption; - return r; - end - function IsContainer(cd);override; - begin - if cd is class(TTabSheet) then return true; - return false; - end - function GetPageID(page); - begin - {** - @explan(说明)获取page的序号 %% - **} - r := -1; - if page is class(TTabSheet) then - begin - for it := 0 to FTabItems.length()-1 do - begin - if FTabItems[it].PageSheet = page then - begin - return it; - end - end - end - return r; - end - function DoControlAlign();override; - begin - CalcTabs(); - for i := 0 to FTabItems.length()-1 do - begin - it := FTabItems[i]; - if it and it.PageSheet then - begin - pg := it.PageSheet; - if i=FCurrentid then - begin - pg.Visible := true; - rc := getsheetrect(); - if not rc then return ; - rc[1]+=1; - if csDesigning in ComponentState then - begin - rc[0]+=2; - rc[2]-=2; - rc[3]-=2; - end - pg.SetBoundsrect(rc); - end else - pg.Visible := false; - end - end - end - function RemovePageTab(id); - 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=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)(TTabSheet) sheet; - **} - if not(page is class(TTabSheet)) 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(TTabSheet)) 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)(TTabSheet)sheet %%; - **} - if not(page is class(TTabSheet)) then return -1; - addcontrol(page); - end - function SetTabText(i,Value); - begin - {** - @explan(说明)修改tab标签文字 %% - @param(i)(integer)序号 %%; - @param(Value)(string)文本 %%; - **} - it := FTabItems[i]; - if it then - begin - if Value = it.caption then - begin - CalcTabs(); - InvalidateRect(nil,false); - end else - begin - it.Caption := Value; - end - end - end - function SetTabIndex(AIndex,AIndexnew); - begin - {** - @explan(说明) 修改标签的次序 %% - @param(AIndex)(integer) 位置 %% - @param(AIndexnew)(integer) 新位置 %% - - **} - if (AIndex<>AIndexnew) and (AIndex>=0) and - (AIndex=0) and (AIndexnewFrange[1] then - Fposition := Frange[0]; - else if Fposition0 then - begin - setPosition(n*Fstep); - end - return r; - end - property smooth:bool read Fsmooth write setSmooth; - property vertical:bool read Fvertical write setVertical; - {** - @param(smooth)(bool)进度条平滑移动%% - @param(vertical)(bool)进度条垂直移动%% - **} - property range:pairint read Frange write setRangeA; - property position:integer read Fposition write setPosition; - property stepincrement:integer read Fstep write setStep; - property barColor:color read FbarColor write setIndicatorBarColor; - {** - @param(range)(array of integer)进度栏的上下限%% - @param(position)(integer)进度条的位置%% - @param(stepincrement)(integer)进度栏的步增量%% - **} function publishs();override; begin return array("name", @@ -5690,105 +4376,8 @@ type tprogressbar=class(TCustomControl) "vertical","range","position","barcolor","onmousemove","onpopupmenu", "onmousedown","onmouseup"); end - private - Fsmooth; - Fvertical; - Frange; - Fposition; - Fstep; - FbarColor; - private - function setSmooth(n); - begin - Fsmooth := n; - end - function setVertical(n); - begin - nv := n?true:false; - if nv = Fvertical then return ; - Fvertical := nv; - InvalidateRect(nil,false); - end - function isValidPosition(n); - begin - return n>=Frange[0] and n<=Frange[1]; - end - function isValidColorValue(n); - begin - if ifint(n) then - return not (n.&0xFF000000); - else - if ifint64(n) then - return not (n.&0xFFFFFFFFFF000000); - else return 0; - end - function setRange(l,h);begin - {** - @explan(说明)设置进度栏的上下限,要求上限高于下限且皆非负%% - @param(l)(integer)下限%% - @param(h)(integer)上限%% - @return(integer)1:成功;0:失败;-1:出错%% - **} - if Frange=array(l,h) then return ; - if ifnumber(l) and ifnumber(h) and l>=0 and h>=l+1 then - begin - l:=integer(l); - h:=integer(h); - Frange:=array(l,h); - Fposition:=Fpositionh?h:Fposition); - return 1; - end - - end - function setRangeA(arr);begin - return setRange(arr[0],arr[1]); - end - function setPosition(n); - begin - {** - @explan(说明)设置进度条位置,当其超过限度则设置位置至该限度%% - @param(n)(integer)要设置的位置%% - @return(integer)先前位置,出错则返回-1%% - **} - r := Fposition; - if ifnumber(n) and isValidPosition(n) then - begin - Fposition:=n; - InvalidateRect(nil,false); - end - return r; - end - function setStep(n);begin - {** - @explan(说明)设置进度栏步增量%% - @param(n)(integer)要设置的值%% - @return(integer)1:成功;0:失败;-1:出错%% - **} - if Fstep=n then return ; - d := Frange[1]-Frange[0]; - if ifnumber(n) and n<=d then - begin - Fstep:=integer(n); - InvalidateRect(nil,false); - return 1; - end - end - function setIndicatorBarColor(clr); - begin - {** - @explan(说明)设置进度条颜色%% - @param(clr)(integer)要设置的颜色的rgb值%% - @return(integer)1:成功;0:失败;-1:出错%% - **} - if ifnumber(clr) and FbarColor<>clr and isValidColorValue(clr) then - begin - FbarColor:=integer(clr); - InvalidateRect(nil,false); - return 1; - end - end -end +end type tmonthcalendar = class(TCustomControl) {** @explan(说明)月历控件 @@ -5837,7 +4426,7 @@ type tmonthcalendar = class(TCustomControl) r := FCalender.ExecuteCommand("meselbypos",e.pos); if std=3 or r="today" then begin - calldatafunction(FonSelect,self(true),new tuieventbase(0,0,0,0)); + CallMessgeFunction(FonSelect,self(true),new tuieventbase(0,0,0,0)); end end end @@ -5876,7 +4465,7 @@ type tmonthcalendar = class(TCustomControl) end function DoDatechanged(); begin - calldatafunction(FonSelectChange,self(true),new tuieventbase(0,0,0,0)); + CallMessgeFunction(FonSelectChange,self(true),new tuieventbase(0,0,0,0)); end function recycling();override; begin @@ -5889,11 +4478,6 @@ type tmonthcalendar = class(TCustomControl) property TodayButton:bool read getnoTodayButton write setNoTodayButton; property onSelect:eventhandler read FonSelect write FonSelect; property onSelectChange:eventhandler read FonSelectChange write FonSelectChange; - {** - @param(todayButton)(bool)月历显示“今日”按钮(默认开启)%% - @param(onSelect)(function[tmonthcalendar,tuieventbase])显式选择日期%% - @param(onSelectChange)(function[tmonthcalendar,tuieventbase])选择日期改变%% - **} function publishs();override; begin return array("name","caption","anchors","enabled","font", @@ -5901,6 +4485,12 @@ type tmonthcalendar = class(TCustomControl) "height","width","left","top","border","onmousemove","onpopupmenu", "onmousedown","onmouseup","onselect","onselectchange"); end + {** + @param(todayButton)(bool)月历显示“今日”按钮(默认开启)%% + @param(onSelect)(function[tmonthcalendar,tuieventbase])显式选择日期%% + @param(onSelectChange)(function[tmonthcalendar,tuieventbase])选择日期改变%% + **} + private function setNoTodayButton(v); begin @@ -5917,7 +4507,6 @@ type tmonthcalendar = class(TCustomControl) FonSelectChange; end - type tdatetimepicker = class(tthreeEntry) {** @explan(说明) 日期选择控件 %% @@ -6279,417 +4868,20 @@ type ttimepicker = class(tthreeEntry) FRectDown; Fonselectchange; end - -type tIPAddr = class(TCustomControl) +type tipaddr = class(tcustomipaddr) {** @explan(说明) ip控件 %% **} - private - type tipeditor = class(teditable) - function create(); - begin - inherited; - border := false; - FRange := array(0,1); - UnLocked := true; - end - function doonmaxtext();override; - begin - if FNext and Fnext.Visible then - begin - KillFocus(); - ExecuteCommand("ecclcsel"); - FNext.SetFocus(); - FNext.ExecuteCommand("ecsel",array(1,10)); - end - end - function doOnChange();override; - begin - if host and UnLocked then - begin - host.DoIpChanged(); - end - end - function GoToPrev(); - begin - if FPrev then - begin - KillFocus(); - ExecuteCommand("ecclcsel"); - FPrev.SetFocus(); - FPrev.ExecuteCommand("ecsel",array(10,1)); - end - end - function WMCHAR(o,e);override; - begin - case e.char of - "0" to "9" : - begin - inherited; - end - " ","\t",".": - begin - doonmaxtext(); - end - chr(VK_BACK): - begin - inherited; - idx := ExecuteCommand("eccaretpos"); - if idx=1 then return GoToPrev(); - end - end - end - function WMKEYDOWN(o,e);override; - begin - case e.CharCode of - VK_LEFT: - begin - idx := ExecuteCommand("eccaretpos"); - if idx=1 then return GoToPrev(); - end - VK_RIGHT: - begin - idx := ExecuteCommand("eccaretpos"); - if idx>length(self.Text) then - begin - return doonmaxtext(); - end - end - end ; - inherited; - end - function GetNumValue(); - begin - t := Text; - r := StrToIntDef(t,FRange[0]); - return r; - end - function GetTureText(); - begin - return Inttostr(GetNumValue()); - end - function SetNumValue(v); - begin - if v<=FRange[0] then return text := inttostr(FRange[0]); - if v>=FRange[1] then return text := inttostr(FRange[1]); - if vFRange[0] then text := inttostr(v); - end - function SetRange(a,b); - begin - if a>=0 and b>a then - begin - if a <> FRange[0] or b<>FRange[1] then - begin - FRange := array(a,b); - L := 1; - while 10^L=0 and i<=4 then - FEditors[integer(i)].SetRange(low,high); - end - function DoControlAlign();override; - begin - calcportsize(); - end - function MouseUp(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then - return v.MouseUp(o,e); - end - return inherited; - end - function MouseMove(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then - return v.MouseMove(o,e); - end - return inherited; - end - function MouseDown(o,e);override; - begin - if csDesigning in ComponentState then return ; - idx := -1; - for i,v in FEditors do - begin - if pointinrect(e.pos,v.GetEntryRect()) then - begin - idx := i; - //v.MouseDown(o,e); - end else v.KillFocus(); - end - if idx>=0 then return FEditors[idx].MouseDown(o,e); - return inherited; - end - function dosetfocus(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then return v.SetFocus(); - end - for i,v in FEditors do - begin - return v.SetFocus(); - end - inherited; - end - function dokillfocus(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then return v.killFocus(); - end - inherited; - end - function keypress(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then return v.WMCHAR(o,e); - end - - inherited; - end - function KeyDown(o,e);override; - begin - if csDesigning in ComponentState then return ; - for i,v in FEditors do - begin - if v.HasFocus then return v.WMKEYDOWN(o,e); - end - inherited; - end - - function Recycling();override; - begin - FaddrChange := nil; - FIpe1 := nil; - FIpe2 := nil; - FIpe3 := nil; - FIpe4 := nil; - FPort := nil; - for i,v in FEditors do v.Recycling(); - FEditors := array(); - inherited; - end - property HasPort:bool read FHasPort write SetHasPort; - property ipaddr:string read getAddress write setAddress; - property onAddrChange:eventhandler read FaddrChange write FaddrChange; - {** - @param(ipaddr)(string)ip地址%% - @param(onAddrChange)(function[tIPAddr,tuieventbase])id地址变化回调%% - **} - private - FEditors; - FHasPort; - FIpe1; - FIpe2; - FIpe3; - FIpe4; - FPort; - FFontwidth; - FaddrChange; - Fsynrects; - function getAddress(); - begin - r := ""; - for i:= 0 to 3 do - begin - r+=FEditors[i].GetTureText(); - if i<3 then r+="."; - end - if FHasPort then - begin - r += ":"+ FPort.GetTureText(); - end - return r; - end - function setAddress(v); - begin - if not ifstring(v) then return ; - r := getAddress(); - v1 := str2array(v,":"); - vs := str2array(v1[0],"."); - fipe1.UnLocked := false; - for i:=0 to min(length(vs)-1,3) do - FEditors[i].SetNumValue(StrToIntDef(vs[i],0)); - if v1[1] then - begin - FPort.SetNumValue(StrToIntDef(v1[1],0)) ; - end - fipe1.UnLocked := true; - r1 := getAddress(); - if r<>r1 then - begin - DoIpChanged(); - end - end - function SetHasPort(v); - begin - nv := v?true:false; - if FHasPort <>nv then - begin - FHasPort := nv; - - calcportsize(); - FPort.Visible := nv; - InvalidateRect(nil,false); - end - end - function calcportsize(); - begin - if not( FIpe1 and FIpe2 and FIpe3 and FIpe4 and FPort) then return ; - rc := ClientRect; - wd := rc[2]-rc[0]-2; - h := rc[3]-rc[1]-2; - if wd<56 then return ; - ewd := integer((wd-FFontwidth*(3+FHasPort)-10)/(4+FHasPort)); - rc1 := array(1,1,ewd,h); - FIpe1.ClientRect := rc1; - rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); - FIpe2.ClientRect := (rc1); - rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); - FIpe3.ClientRect := (rc1); - if FHasPort then rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); - else - rc1 := array(rc1[2]+FFontwidth+1,1,rc[2],h); - FIpe4.ClientRect := (rc1); - if FHasPort then - begin - rc1 := array(rc1[2]+FFontwidth+1,1,rc[2],h); - FPort.ClientRect := (rc1); - FPort.visible := true; - end - Fsynrects := array(); - wd+=2; - ewd := integer((wd-FFontwidth*(3+FHasPort)-10)/(4+FHasPort)); - rc1 := rc; - rc1[1] := integer(rc1[3]/5); - rc1[0]:= (FIpe1.ClientRect)[2];; - rc1[2] := rc1[0]+FFontwidth; - Fsynrects[0][0] := "."; - Fsynrects[0][1] := rc1; - rc1[0]:= (FIpe2.ClientRect)[2]; - rc1[2] := rc1[0]+FFontwidth; - Fsynrects[1,0] := "."; - Fsynrects[1,1] := rc1; - rc1[0]:= (FIpe3.ClientRect)[2];; - rc1[2] := rc1[0]+FFontwidth; - Fsynrects[2,0] := "."; - Fsynrects[2,1] := rc1; - rc1[0]:= (FIpe4.ClientRect)[2];; - rc1[2] := rc1[0]+FFontwidth; - Fsynrects[3,0] := ":"; - Fsynrects[3,1] := rc1; - end - public function publishs();override; begin return array("name","align","anchors","caption","visible","height","width","left","top", "ipaddr","HasPort","onAddrChange","border","wsdlgmodalframe"); end -end - +end type TSpinEdit=class(TCustomSpinEdit) {** @@ -6922,10 +5114,17 @@ type TCanvas = class(TCustomcanvas) end end type TTimer = class(TCustomTimer) + {** + @explan(说明)定时器类,间隔是以毫秒为最小单位 %% + **} function create(AOwner);override; begin inherited; end + function publishs();override; + begin + return array("name","interval","ontimer"); + end end //******action 相关***************************************** @@ -6959,470 +5158,65 @@ end //***************************** -type TCommDlg=class(tcomponent) - {** - @explan(说明) 选择对话框类 %% - **} - private - FChooseOk; - FWndOwner; - FCaption; - function SetParent(p); - begin - FWndOwner := p; - end - protected - function SetCaption(v);virtual; - begin - FCaption := v; - end - public - function create(AOwner);override; - begin - inherited; - end - function Notification(AComponent,Operation);override; - begin - if Operation=opRemove then - begin - if AComponent=FWndOwner then FWndOwner := nil; - end - inherited; - end - function OpenDlg(); - begin - {** - @explan(说明) 打开对话框 %% - **} - return FChooseOk := ChooseDlg(); - end - function ChooseDlg();virtual; - begin - {** - @explan(说明) 打开对话框虚函数 - **} - end - property ChooseOk read FChooseOk; - property WndOwner:variable read FWndOwner write FWndOwner; - property Parent read FWndOwner write SetParent; - property Caption:string read FCaption write SetCaption; - {** - @param(ChooseOk)(bool) 是否执行成功 %% - @param(WndOwner)(TWinControl) 所属窗口 %% - **} -end - -type TMessageboxADlg=class(TCommDlg) +type TMessageboxADlg = class(TcustommsgADlg) {** @explan(说明) 消息提示框 %% **} - private - FmbText; - Fbtnvals; - Ficonvals; - Fbtnval; - Ficonval; - function setMbtext(v) - begin - if FmbText <> v then - begin - FmbText := v; - end - end - function setcaption(v);override; - begin - if caption=v then exit; - inherited; - end - function setmbbtnstyle(v) - begin - if Fbtnval <> v and(v in Fbtnvals)then - begin - Fbtnval := v; - end - end - function setmbiconstyle(v) - begin - if Ficonval <> v and(v in Ficonvals)then - begin - Ficonval := v; - end - end - public - function create(AOwner);override; + function create(AOwner); begin inherited; - FmbText := ""; - caption := "提示"; - Fbtnval := 0; - Ficonval := 48; - Fbtnvals := array(0,1,2,3,4,5,6,16384); - Ficonvals := array(48,64,32,16); - end - function ChooseDlg();override; - begin - hd := 0; - if Parent is class(TWinControl)then hd := Parent.Handle; - r := _wapi.MessageBoxA(hd,mbText,self.caption,Fbtnval .| Ficonval); - return r; - end - { - 判断messagebox按钮是否被按下:根据 ChooseDlg()函数的返回值进行判断 - 代码 值 描述 - IDABORT 3 "中止"按钮被选中 - IDCANCEL 2 "取消"按钮已被选中 - IDCONTINUE 11 "继续"按钮被选中 - IDIGNORE 5 "忽略"按钮已被选中 - IDNO 7 在"NO"按钮被选中 - IDOK 1 "OK"按钮被选中 - IDRETRY 4 "重试"按钮被按下 - IDTRYAGAIN 10 "再试一次"按钮被按下 - IDYES 6 "yes"按钮被选中 - } - property mbText:string read FmbText write setMbtext; - property mbbtnstyle:MBbtnstyle read Fbtnval write setmbbtnstyle; - property mbiconstyle:MBiconstyle read Ficonval write setmbiconstyle; - {** - @param(mbText)(string)字符串%% - @param(mbbtnstyle)(TMBbtnstyle)按钮样式%% - @param(mbiconstyle)(TMBiconstyle)图标样式%% - **} + end function publishs();override; begin return array("name","chooseok","caption", "mbtext","mbbtnstyle","mbiconstyle"); end -end -type TColorChooseADlg=class(TCommDlg) +end +type TColorChooseADlg = class(tcustomcolordlg) {** @explan(说明)颜色选择器 %% **} - private - Fdlgcolor; - function SetCustomColors(cols); - begin - if ifarray(cols)then - begin - Fdlgcolor.lpcustcolors._setvalue_(0,cols); - end - end - function GetCustomColors(); - begin - return Fdlgcolor.lpcustcolors._getdata_(); - end - function SetResult(c); - begin - Fdlgcolor.rgbresult := c; - end - function GetResult() - begin - r := Fdlgcolor.rgbresult; - return r; - end - public - function create(AOwner);override; + function create(AOwner); begin inherited; - Fdlgcolor := new ttagCHOOSECOLORA(); - end - function ChooseDlg();override; - begin - Fdlgcolor.flags := CC_RGBINIT .| CC_SOLIDCOLOR; //.| CC_SHOWHELP .| CC_SOLIDCOLOR; - if WndOwner is class(TWinControl)then Fdlgcolor.hwndowner := WndOwner.Handle; - r := _wapi.ChooseColorA(Fdlgcolor._getptr_); - return r; - end - {** - @param(CustomColors)(array of integer) 自定义颜色 %% - @param(RgbResult)(integer) 颜色rgba值 %% - **} - property CustomColors read GetCustomColors write SetCustomColors; - property Result:color read GetResult write SetResult; + end function publishs();override; begin return array("name","chooseok","caption", "customcolors","result"); end -end -type TFontChooseADlg=class(TCommDlg) +end +type TFontChooseADlg = class(tcustomfontdlg) {** @explan(说明) 字体选择对话框 %% **} - private - FFontChoose; - function SetFontInfo(v); - begin - FFontChoose.SetFontInfo(v); - if ifnumber(v["color"])then FFontChoose.rgbcolors := v["color"]; - end - function GetFontInfo(); - begin - r := GetFont(); - if r is class(ttagLOGFONTA)then r := r._getdata_(); - if ifarray(r)then - begin - r["color"]:= FFontChoose.rgbcolors; - fh := r["height"]; - if fh<0 then r["height"]:= abs(fh); - fw := r["width"]; - if fw=0 then r["width"]:= integer(abs(fh/2)); - else if fw<0 then r["width"]:= abs(fw); - end - return r; - end - function GetFont(); - begin - return FFontChoose.lplogfont; - end - function SetColor(v); - begin - FFontChoose.rgbcolors := V; - end - public - function create(AOwner);override; + function Create(AOwner); begin inherited; - FFontChoose := new ttagCHOOSEFONTA(); - FFontChoose.flags := CF_EFFECTS .| CF_INITTOLOGFONTSTRUCT; //.|CF_BOTH ; - end - function ChooseDlg();override; - begin - if WndOwner is class(TWinControl)then FFontChoose.hwndowner := WndOwner.Handle; - return _wapi.ChooseFontA(FFontChoose._getptr_); - end - property FontInfo:font read GetFontInfo write SetFontInfo; - property color Write SetColor; + end function publishs();override; begin array("name","chooseok","caption","color"); end - {** - @param(LogFont)(ttagLOGFONTA) 逻辑字体对象%% - @param(FontInfo)(array) 字体信息数组 %% - **} -end -type TSavefileADlg = class(TCommDlg) + +end +type TSavefileADlg = class(tcustomfsdlg) {** @explan(说明) 保存文件,获得文件名 %% @param(FFileTag)(TtagOFNA)openfile 对象 %% **} - protected FFileTag; - function dlgType();virtual; - begin - //对话框类型:0x1:保存为窗口。0x2:打开窗口。 - return 1; - end - function setCaption(s);override; - begin - if ifstring(s)then - begin - inherited; - FFileTag.lpstrtitle := s; - end - end - private - FFilter; - Ffilterindex; - fIsShowHidden; - fIsMultiselected; - fIsOverwritePrompt; - fIsLinkFilePath; - fIsCreatePrompt; - fIsFileMustExist; - finitialdir; - function setFlagsBit(b,m,n); - begin - //b:要设置的位的值,m:要设置的位的值的保存成员,n:要设置的位。 - if xor(b,m)then - begin - if b then FFileTag.Flags .|= n; - else FFileTag.Flags :=.!((.!FFileTag.Flags).| n); - m := b; - end - end - function setShowHidden(b); - begin - setFlagsBit(b,fIsShowHidden,0x10000000); - end - function setMultiSelected(b); - begin - tb := fIsMultiselected; - setFlagsBit(b,fIsMultiselected,0x200); - if b and tb <> fIsMultiselected then - begin - s := ""; - setlength(s,1024 * 16); - FFileTag.lpstrfile := s; - end - end - function setOverwritePrompt(b); - begin - setFlagsBit(b,fIsOverwritePrompt,0x2); - end - function setLinkFilePath(b); - begin - setFlagsBit(b,fIsLinkFilePath,0x100000); - end - function setCreatePrompt(b); - begin - setFlagsBit(b,fIsCreatePrompt,0x2000); - end - function setFileMustExist(b); - begin - //FFileTag.SetValue(); - setFlagsBit(b,fIsFileMustExist,0x1000); - end - function GetResult(); - begin - return FFileTag.lpstrfile; - end - function setfilter(f); - begin - {** - @explan(说明)设置筛选条件%% - @param(f)(array)筛选条件采用字符串下标的字符串数组,下标作为显示,值作为筛选条件 - array("所有文件":"*.*","tsl流文件":"*.stm") - %% - **} - if FFilter=f then exit; - s := ""; - rf := array(); - if ifarray(f)then - begin - for i,v in f do - begin - if v and ifstring(v)and ifstring(i)then - begin - s += i+"\0"+v+"\0"; - rf[i]:= v; - end - end - end - if length(s)then - begin - s += "\0"; - FFileTag.lpstrfilter := s; - FFilter := rf; - end - Ffilterindex := 1; - end - function OpenFileDlg();virtual; - begin - r := _wapi.GetSaveFileNameA(FFileTag._getptr_); - return r; - end - function setDefaultFileExtension(s); - begin - if ifstring(s)then FFileTag.lpstrdefext := s; - end - function getDefaultFileExtension(); - begin - return FFileTag.lpstrdefext; - end - function setInitialDir(s); - begin - if ifstring(s)and s <> "" then - begin - finitialdir.setv(s); - FfileTag.lpstrinitialdir := finitialdir.ptr; - end else - FfileTag.lpstrinitialdir := 0; - end - function getInitialDir(); - begin - if FFileTag.lpstrinitialdir=finitialdir.ptr then return finitialdir.getv(); - else return ""; - end - public function create(AOwner);override; begin inherited; - FFileTag := new TtagOFNA(); - FFileTag.Flags .|= 0x80000; // .| OFN_ENABLEHOOK; - //FFileTag.hinstance := happ; - //FFileTag.lpfnHook := getwinprocptr(0x10); - finitialdir := new tcstring(512); - //FFileTag.lcustdata := finitialdir._getptr_;// 0x178; - //echo tostn(FFileTag._getdata_); - end - function getSelectedItemName(); - begin - {** - @explan(说明)获取所选择文件的文件名%% - @return(string)当选择不止一个文件时,该函数返回首文件名。%% - **} - return FFileTag.lpstrfiletitle; - end - function ChooseDlg();override; - begin - {** - @explan(说明)打开一个对话框以使用户选择将要打开或保存的文件的路径%% - @return(bool)是否选择了有效的文件路径%% - **} - if WndOwner is class(TWinControl)then FFileTag.hwndowner := WndOwner.Handle; - if Ffilterindex>0 and FFilter then FFileTag.nfilterindex := Ffilterindex; - FFileTag.lpstrfile := "\0\0"; - FFileTag.lpstrfiletitle := ""; - r := OpenFileDlg(); - if FFilter then Ffilterindex := FFileTag.nfilterindex; - return r; - end - function getResults(); - begin //r2 - {** - @explan(说明)获取所选择文件的完整路径%% - @return(array)所选择文件路径的数组%% - **} - s := FFileTag._getvalue_("lpstrfile",FFileTag.nmaxfile); - r := array(); - i := 0; - l := length(s); - while i <= l and s[++i]<> '\0' do; - if not i then return r; - t := s[1:i-1]; - if not Multiselected or(i l do if s[i]='\0' then - begin - r[j++]:= t+s[b+1:i-1]; - if s[i+1]='\0' then break; - b := i; - end - return r; - end - property filter:filefilter read FFilter write setfilter; - property filterindex read Ffilterindex write Ffilterindex; - property FileName read GetResult; - // property struct read FFileTag write FFileTag; - property DefaultFileExtension:string read getDefaultFileExtension write setDefaultFileExtension; - property initialDir:filename read getInitialDir write setInitialDir; - property ShowHidden:bool read fIsShowHidden write setShowHidden; - property Multiselected:bool read fIsMultiselected write setMultiselected; - property OverwritePrompt:bool read fIsOverwritePrompt write setOverwritePrompt; - property LinkFilePath:bool read fIsLinkFilePath write setLinkFilePath; - property FileMustExist:bool read fIsFileMustExist write setFileMustExist; - property CreatePrompt:bool read fIsCreatePrompt write setCreatePrompt; + end function publishs();override; begin return array("name","caption","filter","filterindex","filename","defaultfileextension","initialdlg", "showhidden","multiselected","overwriteprompt","linkfilepath","filemustexist","createprompt"); end - {** - @param(filter)(array) array("所有文件":"*.*","tsl流文件":"*.stm")%% - @param(FileName)(string) 文件名,不成功返回上一次的结果。 %% - @param(DefaultFileExtension)(string) 默认扩展名,当文件名输入框中未指定扩展名且未选择保存类型时将使用该扩展名,用于保存对话框。 %% - @param(initialDir)(string) 默认打开路径 %% - @param(caption)(string) 对话框名称。%% - @param(ShowHidden)(bool) 是否强制显示隐藏文件。 %% - @param(Multiselected)(bool) 可多选,用于打开对话框。 %% - @param(OverwritePrompt)(bool) 开启覆盖保存提醒,用于保存对话框。 %% - @param(LinkFilePath)(bool) 若所选为快捷方式文件则返回该文件本身路径;默认返回其指向文件的路径。 %% - @param(CreatePrompt)(bool) 若在文件名输入框中输入不存在的文件名则提示是否创建;默认则不提示而直接返回路径,用于打开对话框。 %% - @param(FileMustExist)(bool) 若在文件名输入框中输入不存在的文件名则提示文件名不存在;默认则不提示而直接返回路径,用于打开对话框。 %% - **} -end -type TOpenFileADlg=class(TSavefileADlg) + +end +type TOpenFileADlg=class(tcustomfsdlg) {** @explan(说明) 打开文件对话框类 %% **} @@ -7448,105 +5242,35 @@ type TOpenFileADlg=class(TSavefileADlg) "defaultfileextension","initialdlg","showhidden","multiselected","linkfilepath"); end end -type TFolderChooseADlg=class(TCommDlg) +type TFolderChooseADlg = class(tcustomfolderdlg) {** @explan(说明) 文件夹路径选择对话框 %% **} - private - FBrowse; - FFolder; - FRootFold; - FRootStr; - FEditBox; - FDefaultDirstr; - FDefaultDir; - function SetDefaultDir(d); - begin - if ifstring(d)and d <> FDefaultDirstr then - begin - FDefaultDirstr := d; - FDefaultDir.setv(d); - end - end - function freeil(); - begin - if FRootFold then _wapi.ILFree(FRootFold); - FRootFold := nil; - FRootStr := nil; - end - function SetEditBox(v); - begin - nv := v?true:false; - if FEditBox <> nv then - begin - FEditBox := nv; - end - end - function SetRootFold(p); - begin - if ifnil(p)then freeil(); - if not(p and ifstring(p))then exit; - if FRootStr=p then exit; - freeil(); - FRootFold := _wapi.ILCreateFromPathA(p); - if FRootFold then FRootStr := p; - end - public - function create(AOwner);override; + function create(AOwner); begin inherited; - FEditBox := true; - FDefaultDir := new tcstring(1024); - FBrowse := new TBrowseinfoA(); - end - function ChooseDlg();override; - begin - if WndOwner is class(TWinControl)then FBrowse.hwndowner := WndOwner.Handle; - if FRootFold then FBrowse.pidlroot := FRootFold; - flg := 0x8; - if FEditBox then flg .|= 0x00000010; - //if FNewFolder then flg .|= 0x00000040 .| 0x00000100 .| 0x00000080; - FBrowse.ulflags := flg; - if FDefaultDirstr then - begin - FBrowse.lparam := FDefaultDir.ptr; - FBrowse.lpfn := getwinprocptr(0x11); - end - ft := _wapi.SHBrowseForFolderA(FBrowse._getptr_); - if not ft then return 0; - s := s1 := ""; - setlength(s1,1024); - f := _wapi.SHGetPathFromIDListA(ft,s1); - if not f then return 0; - for i := 1 to length(s1) do - begin - ts := s1[i]; - if ts="\0" then break; - s += ts; - end - FFolder := s; - return true; - end - property DefaultDir read FDefaultDirstr write SetDefaultDir; - property RootFolder:directory read FRootStr write SetRootFold; - property Folder read FFolder; - property EditBox:bool read FEditBox write SetEditBox; + end function publishs();override; begin return array("name","caption", "defaultdir","rootfolder","folder"); end - {** - @param(Folder)(string) 文件夹路径 %% - **} -end +end //菜单 type TMenu = class(TcustomMenu) + {** + @explan(说明) 菜单 %% + **} function create(AOwner);override; begin inherited; end + function publishs();override; + begin + return array("action","bitmap","caption","checked","enabled","name","tseparator", + "onclick","onrbuttonup","onselect"); + end end type TPopupmenu=class(TcustomPopupmenu) {** @@ -7556,12 +5280,23 @@ type TPopupmenu=class(TcustomPopupmenu) begin inherited; end + function publishs();override; + begin + return array("name","caption","enabled","onrbuttonup"); + end end type TMainmenu = class(TcustomMainmenu) + {** + @explan(说明) 主窗口菜单 %% + **} function create(AOwner);override; begin inherited; end + function publishs();override; + begin + return array("name"); + end end type TApplicationProperties=class(TComponent) @@ -8176,6 +5911,10 @@ type TClipBoard = class(TcustomClipBoard) begin inherited; end + function publishs();override; + begin + return array("name","text","bmp"); + end end //线程 @@ -10399,9 +8138,7 @@ type TDragManager=class(TComponent) procedure MouseDown(Button:TMouseButton;Shift:TShiftState;X,Y:Integer);virtual; public function Create(TheOwner:TComponent);override; - function IsDragging: - boolean; - virtual; + function IsDragging():boolean;virtual; function Dragging(AControl:TControl):boolean;virtual; procedure RegisterDockSite(Site:TWinControl;DoRegister:Boolean);virtual; procedure DragStart(AControl:TControl;AImmediate:Boolean;AThreshold:Integer);virtual; @@ -10990,14 +8727,7 @@ begin npre := bpre; return true; end -function xor(a,b); -begin - {** - @explan(说明) 异或 运算 %% - @return(bool) - **} - return(a and not(b))or(b and not(a)); -end + ////////////////////封装已经移动到其他库的接口为了兼容/////////// function TslToHexFormatStr(tsl); begin diff --git a/funcext/tvclib/utslvcldlg.tsf b/funcext/tvclib/utslvcldlg.tsf new file mode 100644 index 0000000..71aa463 --- /dev/null +++ b/funcext/tvclib/utslvcldlg.tsf @@ -0,0 +1,548 @@ +unit utslvcldlg; +interface +uses cstructurelib,utslvclauxiliary,utslvclmemstruct,utslvclbase; +type TCommDlg=class(tcomponent) + {** + @explan(说明) 选择对话框类 %% + **} + private + FChooseOk; + FWndOwner; + FCaption; + function SetParent(p); + begin + FWndOwner := p; + end + protected + function SetCaption(v);virtual; + begin + FCaption := v; + end + public + function create(AOwner);override; + begin + inherited; + end + function Notification(AComponent,Operation);override; + begin + if Operation=opRemove then + begin + if AComponent=FWndOwner then FWndOwner := nil; + end + inherited; + end + function OpenDlg(); + begin + {** + @explan(说明) 打开对话框 %% + **} + return FChooseOk := ChooseDlg(); + end + function ChooseDlg();virtual; + begin + {** + @explan(说明) 打开对话框虚函数 + **} + end + property ChooseOk read FChooseOk; + property WndOwner:variable read FWndOwner write FWndOwner; + property Parent read FWndOwner write SetParent; + property Caption:string read FCaption write SetCaption; + {** + @param(ChooseOk)(bool) 是否执行成功 %% + @param(WndOwner)(TWinControl) 所属窗口 %% + **} +end +type TcustommsgADlg=class(TCommDlg) + {** + @explan(说明) 消息提示框 %% + **} + private + FmbText; + Fbtnvals; + Ficonvals; + Fbtnval; + Ficonval; + function setMbtext(v) + begin + if FmbText <> v then + begin + FmbText := v; + end + end + function setcaption(v);override; + begin + if caption=v then exit; + inherited; + end + function setmbbtnstyle(v) + begin + if Fbtnval <> v and(v in Fbtnvals)then + begin + Fbtnval := v; + end + end + function setmbiconstyle(v) + begin + if Ficonval <> v and(v in Ficonvals)then + begin + Ficonval := v; + end + end + public + function create(AOwner);override; + begin + inherited; + FmbText := ""; + caption := "提示"; + Fbtnval := 0; + Ficonval := 48; + Fbtnvals := array(0,1,2,3,4,5,6,16384); + Ficonvals := array(48,64,32,16); + end + function ChooseDlg();override; + begin + hd := 0; + if Parent is class(TWinControl)then hd := Parent.Handle; + r := _wapi.MessageBoxA(hd,mbText,self.caption,Fbtnval .| Ficonval); + return r; + end + { + 判断messagebox按钮是否被按下:根据 ChooseDlg()函数的返回值进行判断 + 代码 值 描述 + IDABORT 3 "中止"按钮被选中 + IDCANCEL 2 "取消"按钮已被选中 + IDCONTINUE 11 "继续"按钮被选中 + IDIGNORE 5 "忽略"按钮已被选中 + IDNO 7 在"NO"按钮被选中 + IDOK 1 "OK"按钮被选中 + IDRETRY 4 "重试"按钮被按下 + IDTRYAGAIN 10 "再试一次"按钮被按下 + IDYES 6 "yes"按钮被选中 + } + property mbText:string read FmbText write setMbtext; + property mbbtnstyle:MBbtnstyle read Fbtnval write setmbbtnstyle; + property mbiconstyle:MBiconstyle read Ficonval write setmbiconstyle; + {** + @param(mbText)(string)字符串%% + @param(mbbtnstyle)(TMBbtnstyle)按钮样式%% + @param(mbiconstyle)(TMBiconstyle)图标样式%% + **} +end +type tcustomcolordlg=class(TCommDlg) + {** + @explan(说明)颜色选择器 %% + **} + private + Fdlgcolor; + function SetCustomColors(cols); + begin + if ifarray(cols)then + begin + Fdlgcolor.lpcustcolors._setvalue_(0,cols); + end + end + function GetCustomColors(); + begin + return Fdlgcolor.lpcustcolors._getdata_(); + end + function SetResult(c); + begin + Fdlgcolor.rgbresult := c; + end + function GetResult() + begin + r := Fdlgcolor.rgbresult; + return r; + end + public + function create(AOwner);override; + begin + inherited; + Fdlgcolor := new ttagCHOOSECOLORA(); + end + function ChooseDlg();override; + begin + Fdlgcolor.flags := CC_RGBINIT .| CC_SOLIDCOLOR; //.| CC_SHOWHELP .| CC_SOLIDCOLOR; + if WndOwner is class(TWinControl)then Fdlgcolor.hwndowner := WndOwner.Handle; + r := _wapi.ChooseColorA(Fdlgcolor._getptr_); + return r; + end + {** + @param(CustomColors)(array of integer) 自定义颜色 %% + @param(RgbResult)(integer) 颜色rgba值 %% + **} + property CustomColors read GetCustomColors write SetCustomColors; + property Result:color read GetResult write SetResult; + +end +type tcustomfontdlg=class(TCommDlg) + {** + @explan(说明) 字体选择对话框 %% + **} + private + FFontChoose; + function SetFontInfo(v); + begin + FFontChoose.SetFontInfo(v); + if ifnumber(v["color"])then FFontChoose.rgbcolors := v["color"]; + end + function GetFontInfo(); + begin + r := GetFont(); + if r is class(ttagLOGFONTA)then r := r._getdata_(); + if ifarray(r)then + begin + r["color"]:= FFontChoose.rgbcolors; + fh := r["height"]; + if fh<0 then r["height"]:= abs(fh); + fw := r["width"]; + if fw=0 then r["width"]:= integer(abs(fh/2)); + else if fw<0 then r["width"]:= abs(fw); + end + return r; + end + function GetFont(); + begin + return FFontChoose.lplogfont; + end + function SetColor(v); + begin + FFontChoose.rgbcolors := V; + end + public + function create(AOwner);override; + begin + inherited; + FFontChoose := new ttagCHOOSEFONTA(); + FFontChoose.flags := CF_EFFECTS .| CF_INITTOLOGFONTSTRUCT; //.|CF_BOTH ; + end + function ChooseDlg();override; + begin + if WndOwner is class(TWinControl)then FFontChoose.hwndowner := WndOwner.Handle; + return _wapi.ChooseFontA(FFontChoose._getptr_); + end + property FontInfo:font read GetFontInfo write SetFontInfo; + property color Write SetColor; + + {** + @param(LogFont)(ttagLOGFONTA) 逻辑字体对象%% + @param(FontInfo)(array) 字体信息数组 %% + **} +end +type tcustomfolderdlg=class(TCommDlg) + {** + @explan(说明) 文件夹路径选择对话框 %% + **} + private + FBrowse; + FFolder; + FRootFold; + FRootStr; + FEditBox; + FDefaultDirstr; + FDefaultDir; + function SetDefaultDir(d); + begin + if ifstring(d)and d <> FDefaultDirstr then + begin + FDefaultDirstr := d; + FDefaultDir.setv(d); + end + end + function freeil(); + begin + if FRootFold then _wapi.ILFree(FRootFold); + FRootFold := nil; + FRootStr := nil; + end + function SetEditBox(v); + begin + nv := v?true:false; + if FEditBox <> nv then + begin + FEditBox := nv; + end + end + function SetRootFold(p); + begin + if ifnil(p)then freeil(); + if not(p and ifstring(p))then exit; + if FRootStr=p then exit; + freeil(); + FRootFold := _wapi.ILCreateFromPathA(p); + if FRootFold then FRootStr := p; + end + public + function create(AOwner);override; + begin + inherited; + FEditBox := true; + FDefaultDir := new tcstring(1024); + FBrowse := new TBrowseinfoA(); + end + function ChooseDlg();override; + begin + if WndOwner is class(TWinControl)then FBrowse.hwndowner := WndOwner.Handle; + if FRootFold then FBrowse.pidlroot := FRootFold; + flg := 0x8; + if FEditBox then flg .|= 0x00000010; + //if FNewFolder then flg .|= 0x00000040 .| 0x00000100 .| 0x00000080; + FBrowse.ulflags := flg; + if FDefaultDirstr then + begin + FBrowse.lparam := FDefaultDir.ptr; + FBrowse.lpfn := getwinprocptr(0x11); + end + ft := _wapi.SHBrowseForFolderA(FBrowse._getptr_); + if not ft then return 0; + s := s1 := ""; + setlength(s1,1024); + f := _wapi.SHGetPathFromIDListA(ft,s1); + if not f then return 0; + for i := 1 to length(s1) do + begin + ts := s1[i]; + if ts="\0" then break; + s += ts; + end + FFolder := s; + return true; + end + property DefaultDir read FDefaultDirstr write SetDefaultDir; + property RootFolder:directory read FRootStr write SetRootFold; + property Folder read FFolder; + property EditBox:bool read FEditBox write SetEditBox; + {** + @param(Folder)(string) 文件夹路径 %% + **} +end +type tcustomfsdlg = class(TCommDlg) + {** + @explan(说明) 保存文件,获得文件名 %% + @param(FFileTag)(TtagOFNA)openfile 对象 %% + **} + protected FFileTag; + function dlgType();virtual; + begin + //对话框类型:0x1:保存为窗口。0x2:打开窗口。 + return 1; + end + function setCaption(s);override; + begin + if ifstring(s)then + begin + inherited; + FFileTag.lpstrtitle := s; + end + end + private + FFilter; + Ffilterindex; + fIsShowHidden; + fIsMultiselected; + fIsOverwritePrompt; + fIsLinkFilePath; + fIsCreatePrompt; + fIsFileMustExist; + finitialdir; + function setFlagsBit(b,m,n); + begin + //b:要设置的位的值,m:要设置的位的值的保存成员,n:要设置的位。 + if xor(b,m)then + begin + if b then FFileTag.Flags .|= n; + else FFileTag.Flags :=.!((.!FFileTag.Flags).| n); + m := b; + end + end + function setShowHidden(b); + begin + setFlagsBit(b,fIsShowHidden,0x10000000); + end + function setMultiSelected(b); + begin + tb := fIsMultiselected; + setFlagsBit(b,fIsMultiselected,0x200); + if b and tb <> fIsMultiselected then + begin + s := ""; + setlength(s,1024 * 16); + FFileTag.lpstrfile := s; + end + end + function setOverwritePrompt(b); + begin + setFlagsBit(b,fIsOverwritePrompt,0x2); + end + function setLinkFilePath(b); + begin + setFlagsBit(b,fIsLinkFilePath,0x100000); + end + function setCreatePrompt(b); + begin + setFlagsBit(b,fIsCreatePrompt,0x2000); + end + function setFileMustExist(b); + begin + //FFileTag.SetValue(); + setFlagsBit(b,fIsFileMustExist,0x1000); + end + function GetResult(); + begin + return FFileTag.lpstrfile; + end + function setfilter(f); + begin + {** + @explan(说明)设置筛选条件%% + @param(f)(array)筛选条件采用字符串下标的字符串数组,下标作为显示,值作为筛选条件 + array("所有文件":"*.*","tsl流文件":"*.stm") + %% + **} + if FFilter=f then exit; + s := ""; + rf := array(); + if ifarray(f)then + begin + for i,v in f do + begin + if v and ifstring(v)and ifstring(i)then + begin + s += i+"\0"+v+"\0"; + rf[i]:= v; + end + end + end + if length(s)then + begin + s += "\0"; + FFileTag.lpstrfilter := s; + FFilter := rf; + end + Ffilterindex := 1; + end + function OpenFileDlg();virtual; + begin + r := _wapi.GetSaveFileNameA(FFileTag._getptr_); + return r; + end + function setDefaultFileExtension(s); + begin + if ifstring(s)then FFileTag.lpstrdefext := s; + end + function getDefaultFileExtension(); + begin + return FFileTag.lpstrdefext; + end + function setInitialDir(s); + begin + if ifstring(s)and s <> "" then + begin + finitialdir.setv(s); + FfileTag.lpstrinitialdir := finitialdir.ptr; + end else + FfileTag.lpstrinitialdir := 0; + end + function getInitialDir(); + begin + if FFileTag.lpstrinitialdir=finitialdir.ptr then return finitialdir.getv(); + else return ""; + end + public + function create(AOwner);override; + begin + inherited; + FFileTag := new TtagOFNA(); + FFileTag.Flags .|= 0x80000; // .| OFN_ENABLEHOOK; + //FFileTag.hinstance := happ; + //FFileTag.lpfnHook := getwinprocptr(0x10); + finitialdir := new tcstring(512); + //FFileTag.lcustdata := finitialdir._getptr_;// 0x178; + //echo tostn(FFileTag._getdata_); + end + function getSelectedItemName(); + begin + {** + @explan(说明)获取所选择文件的文件名%% + @return(string)当选择不止一个文件时,该函数返回首文件名。%% + **} + return FFileTag.lpstrfiletitle; + end + function ChooseDlg();override; + begin + {** + @explan(说明)打开一个对话框以使用户选择将要打开或保存的文件的路径%% + @return(bool)是否选择了有效的文件路径%% + **} + if WndOwner is class(TWinControl)then FFileTag.hwndowner := WndOwner.Handle; + if Ffilterindex>0 and FFilter then FFileTag.nfilterindex := Ffilterindex; + FFileTag.lpstrfile := "\0\0"; + FFileTag.lpstrfiletitle := ""; + r := OpenFileDlg(); + if FFilter then Ffilterindex := FFileTag.nfilterindex; + return r; + end + function getResults(); + begin //r2 + {** + @explan(说明)获取所选择文件的完整路径%% + @return(array)所选择文件路径的数组%% + **} + s := FFileTag._getvalue_("lpstrfile",FFileTag.nmaxfile); + r := array(); + i := 0; + l := length(s); + while i <= l and s[++i]<> '\0' do; + if not i then return r; + t := s[1:i-1]; + if not Multiselected or(i l do if s[i]='\0' then + begin + r[j++]:= t+s[b+1:i-1]; + if s[i+1]='\0' then break; + b := i; + end + return r; + end + property filter:filefilter read FFilter write setfilter; + property filterindex read Ffilterindex write Ffilterindex; + property FileName read GetResult; + // property struct read FFileTag write FFileTag; + property DefaultFileExtension:string read getDefaultFileExtension write setDefaultFileExtension; + property initialDir:filename read getInitialDir write setInitialDir; + property ShowHidden:bool read fIsShowHidden write setShowHidden; + property Multiselected:bool read fIsMultiselected write setMultiselected; + property OverwritePrompt:bool read fIsOverwritePrompt write setOverwritePrompt; + property LinkFilePath:bool read fIsLinkFilePath write setLinkFilePath; + property FileMustExist:bool read fIsFileMustExist write setFileMustExist; + property CreatePrompt:bool read fIsCreatePrompt write setCreatePrompt; + + {** + @param(filter)(array) array("所有文件":"*.*","tsl流文件":"*.stm")%% + @param(FileName)(string) 文件名,不成功返回上一次的结果。 %% + @param(DefaultFileExtension)(string) 默认扩展名,当文件名输入框中未指定扩展名且未选择保存类型时将使用该扩展名,用于保存对话框。 %% + @param(initialDir)(string) 默认打开路径 %% + @param(caption)(string) 对话框名称。%% + @param(ShowHidden)(bool) 是否强制显示隐藏文件。 %% + @param(Multiselected)(bool) 可多选,用于打开对话框。 %% + @param(OverwritePrompt)(bool) 开启覆盖保存提醒,用于保存对话框。 %% + @param(LinkFilePath)(bool) 若所选为快捷方式文件则返回该文件本身路径;默认返回其指向文件的路径。 %% + @param(CreatePrompt)(bool) 若在文件名输入框中输入不存在的文件名则提示是否创建;默认则不提示而直接返回路径,用于打开对话框。 %% + @param(FileMustExist)(bool) 若在文件名输入框中输入不存在的文件名则提示文件名不存在;默认则不提示而直接返回路径,用于打开对话框。 %% + **} +end + +implementation +function xor(a,b); +begin + {** + @explan(说明) 异或 运算 %% + @return(bool) + **} + return(a and not(b))or(b and not(a)); +end +initialization +end. \ No newline at end of file diff --git a/funcext/tvclib/utslvclmenu.tsf b/funcext/tvclib/utslvclmenu.tsf index df7edf2..2774174 100644 --- a/funcext/tvclib/utslvclmenu.tsf +++ b/funcext/tvclib/utslvclmenu.tsf @@ -854,11 +854,6 @@ private property Zorder read GetZorder write SetZorder; property OnDesignClick read FOnDesignClick write FOnDesignClick; property ShortCut read getShortCut write SetShortCut; - function publishs();override; - begin - return array("action","bitmap","caption","checked","enabled","name","townerdraw","tseparator", - "onclick","onrbuttonup","onselect"); - end {** @param(Parent)(TcustomMenu|nil)添加父节点,如果非tmenu,从父节点移除 %% @param(OnDrawItem)(function[TcustomMenu,TMDRAWITEM]) 自绘制菜单回调函数 %% @@ -898,10 +893,6 @@ type TcustomPopupmenu=class(TcustomMenu) begin inherited; end - function publishs();override; - begin - return array("name","caption","enabled","onrbuttonup"); - end end type TcustomMainmenu=class(TcustomMenu) {** @@ -961,10 +952,6 @@ type TcustomMainmenu=class(TcustomMenu) return r; end property Hwnd:pointer read FWndHandle write setwndhandle; - function publishs();override; - begin - return array("name"); - end {** @param(Hwnd)()窗口句柄 %%; **} diff --git a/funcext/tvclib/utslvclpage.tsf b/funcext/tvclib/utslvclpage.tsf new file mode 100644 index 0000000..ad19510 --- /dev/null +++ b/funcext/tvclib/utslvclpage.tsf @@ -0,0 +1,698 @@ +unit utslvclpage; +interface +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) + {** + @explan(说明)page控件页面 %% + **} + private + FImageIndex; + protected + function RealSetText(s);override; + begin + inherited; + if ifstring(s) and Parent then + begin + id := parent.GetPageID(self(true)); + Parent.SetTabText(id,s); + 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); + 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 + function paint();override; + begin + drawdesigninggrid(); + end + function DesigningMove();override; + begin + return false; + end + function DesigningSizer();override; + begin + return false; + end + function create(AOwner);override; + begin + inherited; + Caption := "tab"; + Visible := false; + FTabVisible := True; + end + function CreateParams(p);override; + begin + inherited; + p.exstyle := 0x101; + end +end +type tcustompagecontrol = class(TCustomControl) + private + FirstViewIndex; + FCurrentid; + FPrevid; + FTabItems; // + + FOnSelChange; + FOnSelChanging; + //FOnrclick; + FTabPosition; + FTabHeight; + FTabItemswidth; + FScrollBtnRect; + Fprevrect; + fnextrect; + FTabRects; + FClientarea; + function SetTabPosition(v); + begin + if FTabPosition=v then exit; + if not(v in array(alTop,alBottom,alLeft,alRight)) then exit; + FTabPosition := v; + InvalidateRect(nil,false); + DoControlAlign(); + end + function GetTabCount(); + begin + return FTabItems.length(); + end + function CreateTableItem(cp); + begin + r := new tcustomtabitem(); + r.caption := cp; + return r; + end + function CalcTabs(); //计算区域 + begin + rec := ClientRect; //区域 + ft := font; + fw := ft.width; + fh := ft.height; + FTabHeight := fh+7; + FTabItemswidth := array(); + for i := 0 to FTabItems.length()-1 do + begin + pg := FTabItems[i]; + ta := pg.Caption; + FTabItemswidth[i] := max(20, length(ta)*fw+8 ); + end + FMaxsize := 0; + if FTabPosition in array(alLeft,alRight) then + begin + FTabItemswidth := zeros(length(FTabItemswidth))+maxvalue(FTabItemswidth); + FMaxsize := length(FTabItemswidth)*FTabHeight; + end else + begin + FMaxsize := sum(FTabItemswidth); + end + FClientarea := rec; + FScrollBtnRect := 0; + Fprevrect := 0; + fnextrect := 0; + FTabRects := array(); + case FTabPosition of + alLeft: + begin + if FTabItemswidth then + begin + FClientarea[0] :=rec[0]+FTabItemswidth[0]; + if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then + begin + FScrollBtnRect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]); + Fprevrect := array(rec[0],rec[3]-FTabHeight*2,rec[0]+FTabItemswidth[0],rec[3]-FTabHeight); + Fnextrect := array(rec[0],rec[3]-FTabHeight,rec[0]+FTabItemswidth[0],rec[3]); + end else + begin + FirstViewIndex := 0; + end + ybase := 0; + for i,v in FTabItemswidth do + begin + if i>=FirstViewIndex then + begin + FTabRects[i] := array(0,ybase,FTabItemswidth[0],ybase+FTabHeight); + ybase+=FTabHeight; + if xbase>(rec[3]-FTabHeight-FTabHeight) then break; + end + else FTabRects[i] := nil; + end + end + end + alRight: + begin + if FTabItemswidth then + begin + + FClientarea[2] :=rec[2]-FTabItemswidth[0]; + if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then + begin + FScrollBtnRect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]); + Fprevrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight*2,rec[2],rec[3]-FTabHeight); + Fnextrect := array(rec[2]-FTabItemswidth[0],rec[3]-FTabHeight,rec[2],rec[3]); + end else + FirstViewIndex := 0; + ybase := 0; + for i,v in FTabItemswidth do + begin + if i>=FirstViewIndex then + begin + FTabRects[i] := array(rec[2]-FTabItemswidth[0],ybase,rec[2],ybase+FTabHeight); + ybase+=FTabHeight; + if xbase>(rec[3]-FTabHeight-FTabHeight) then break; + end + else FTabRects[i] := nil; + end + end + end + alTop: + begin + if FTabItemswidth then + begin + + FClientarea[1] :=rec[1]+FTabHeight; + if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then + begin + FScrollBtnRect := array(rec[2]-FTabHeight*2,rec[1],rec[2],rec[1]+FTabHeight); + + Fnextrect := array(rec[2]-FTabHeight,rec[1],rec[2],rec[1]+FTabHeight); + Fprevrect := array(rec[2]-FTabHeight*2,rec[1],rec[2]-FTabHeight,rec[1]+FTabHeight); + end else FirstViewIndex := 0; + xbase := 0; + for i,v in FTabItemswidth do + begin + if i>=FirstViewIndex then + begin + FTabRects[i] := array(xbase,0,xbase+FTabItemswidth[i],FTabHeight); + xbase+=FTabItemswidth[i]; + if xbase>(rec[2]-FTabHeight-FTabHeight) then break; + end else + FTabRects[i] := nil; + end + end + end + alBottom: + begin + if FTabItemswidth then + begin + + FClientarea[3] :=rec[3]-FTabHeight; + if length(FTabItemswidth)>1 and (FMaxsize>(rec[2]-rec[0])) then + begin + FScrollBtnRect := array(rec[2]-FTabHeight*2,rec[3]-FTabHeight,rec[2],rec[3]); + Fnextrect := array(rec[2]-FTabHeight,rec[3]-FTabHeight,rec[2],rec[3]); + Fprevrect := array(rec[2]-FTabHeight*2,rec[3]-FTabHeight,rec[2]-FTabHeight,rec[3]); + end else FirstViewIndex := 0; + xbase := 0; + for i,v in FTabItemswidth do + begin + if i>=FirstViewIndex then + begin + FTabRects[i] := array(xbase,rec[3]-FTabHeight,xbase+FTabItemswidth[i],rec[3]); + xbase+=FTabItemswidth[i]; + if xbase>(rec[2]-FTabHeight-FTabHeight) then break; + end else + FTabRects[i] := nil; + end + end + end + end + end + function InsureIdxVisible(id); //确保可见 + begin + if FScrollBtnRect and (not FTabRects[id]) then + begin + if id>FirstViewIndex then + begin + while(not FTabRects[min(id+1,(FTabItems.length()-1))]) do + begin + FirstViewIndex++; + CalcTabs(); + end + end else + if id=0 and id0 then + begin + FirstViewIndex-- ; + CalcTabs(); + InvalidateRect(nil,false); + end + end + function scrollnext(); //滚动到上一个 + begin + if FScrollBtnRect and FirstViewIndex0 then return FTabItems[AIndex].Caption; + return r; + end + function IsContainer(cd);override; + begin + if cd is class(tcustomtabsheet) then return true; + return false; + end + function GetPageID(page); + begin + {** + @explan(说明)获取page的序号 %% + **} + r := -1; + if page is class(tcustomtabsheet) then + begin + for it := 0 to FTabItems.length()-1 do + begin + if FTabItems[it].PageSheet = page then + begin + return it; + end + end + end + return r; + end + function DoControlAlign();override; + begin + CalcTabs(); + for i := 0 to FTabItems.length()-1 do + begin + it := FTabItems[i]; + if it and it.PageSheet then + begin + pg := it.PageSheet; + if i=FCurrentid then + begin + pg.Visible := true; + rc := getsheetrect(); + if not rc then return ; + rc[1]+=1; + if csDesigning in ComponentState then + begin + rc[0]+=2; + rc[2]-=2; + rc[3]-=2; + end + pg.SetBoundsrect(rc); + end else + pg.Visible := false; + end + end + end + function RemovePageTab(id); + 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=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); + begin + {** + @explan(说明)修改tab标签文字 %% + @param(i)(integer)序号 %%; + @param(Value)(string)文本 %%; + **} + it := FTabItems[i]; + if it then + begin + if Value = it.caption then + begin + CalcTabs(); + InvalidateRect(nil,false); + end else + begin + it.Caption := Value; + end + end + end + function SetTabIndex(AIndex,AIndexnew); + begin + {** + @explan(说明) 修改标签的次序 %% + @param(AIndex)(integer) 位置 %% + @param(AIndexnew)(integer) 新位置 %% + + **} + if (AIndex<>AIndexnew) and (AIndex>=0) and + (AIndex=0) and (AIndexnewrec[0] and rec[3]>rec[1]) then return ; + { + AL9_DEFAULT := 0;//0 + AL9_TOPLEFT := 1;//1 + AL9_TOPCENTER := 2 ;//2 + AL9_TOPRIGHT := 3;//3 + AL9_CENTERLEFT := 4 ;//4 + AL9_CENTER := 5 ;//5 + AL9_CENTERRIGHT := 6;//6 + AL9_BOTTOMLEFT := 7 ;//7 + AL9_BOTTOMCENTER := 8;//8 + AL9_BOTTOMRIGHT := 9;//9 + } + df := 0; + case FtextPosition of + 1: df := DT_LEFT; + 2: df := DT_CENTER; + 3: df := DT_RIGHT + 4: df := DT_LEFT .| DT_VCENTER; + 6: df := DT_RIGHT .| DT_VCENTER; + 7: d := DT_BOTTOM .| DT_LEFT; + 8: df := DT_BOTTOM .|DT_CENTER; + 9: df := DT_BOTTOM .| DT_RIGHT; + else + begin + df := DT_CENTER .| DT_VCENTER .| DT_SINGLELINE; + end + end ; + dc := Canvas; + c := caption; + + if ifstring(c) and c then + begin + dc.font := font; + flg := 0; + if not Enabled then + begin + bc := dc.font.color; + dc.font.color := 0xc0c0c0; + flg := 1; + end + dc.drawtext(c,rec,df); + if flg then + begin + dc.font.color := bc; + end + end + + end + function FontChanged(o);override; + begin + inherited; + InvalidateRect(nil,false); + end + function Recycling();override; + begin + inherited; + FonSetFocus := nil; + FonKillFocus := nil; + end + property textPos:AlignStyle9 read FtextPosition write setTextPosition; + property pushLike:bool read FpushLike write setPushLike; + property multiLine:bool read FmultiLine write setMultiLine; + {** + @param(textPos)(member of TAlignStyle9) 文本位置%% + @param(pushLike)(bool)是否为普通按钮外观%% + @param(multiLine)(bool)文本是否为多行显示%% + **} + protected + function SetEnabled(v);override; + begin + nv := v?true:false; + if nv<>Enabled then + begin + inherited; + if HandleAllocated() then + InvalidateRect(nil,false); + end + end + function RealSetText(s);override; + begin + bs := caption; + inherited; + if bs = caption then return ; + InvalidateRect(nil,false); + end + function PaintMouseDown();virtual; + begin + r := ClientRect; + dc := Canvas; + bps := dc.pen.style; + {dc.pen.color := rgb(150,200,230); + dc.pen.width := 1; + dc.pen.style := PS_SOLID; + drawrc(dc,r,1);} + paintfocus(dc,r); + dc.pen.style := PS_DOT; + dc.pen.color := rgb(170,220,250); + drawrc(dc,r,4); + dc.pen.style := bps; + end + private + function paintfocus(dc,r); + begin + dc.pen.color := rgb(150,200,230); + dc.pen.width := 1; + dc.pen.style := PS_SOLID; + drawrc(dc,r,1); + end + function drawrc(dc,r,n); + begin + r[0] += n; + r[2] -= n; + r[1] += n; + r[3] -= n; + dc.moveto(r[array(0,1)]); + dc.LineTo(r[array(2,1)]); + dc.LineTo(r[array(2,3)]); + dc.LineTo(r[array(1,3)]); + dc.LineTo(r[array(0,1)]); + end + function setPushLike(); + begin + + end + function setMultiLine(); + begin + + end + function GetBtnTextRect();virtual; + begin + return ClientRect; + end + function setTextPosition(n); + begin + if not ifnumber(n) or n<0 or n>9 then + n:=0; + else + n:=integer(n); + if FtextPosition=n then return ; + FtextPosition:=n; + InvalidateRect(nil,false); + end + private + FBtnfocused; + FdoingClick; + FpushLike; + FmultiLine; + FtextPosition; + Fbtnstate; +end +type tcustomcheckbtn=class(tcustombtn) + {** + @explan(说明) 复选框 %% + **} + //BM_SETCHECK + public + function create(aowner);override; + begin + inherited; + FcheckState:=0; + FleftText:=0; + end + function click();override; + begin + FcheckState := not FcheckState; + _send_(BM_SETCHECK,FcheckState,0 ); + inherited; + end + function paint();override; + begin + inherited; + drawchekd(FCheckRect); + end + function BMSETCHECK(o,e):BM_SETCHECK;virtual; + begin + FcheckState := e.wparam; + InvalidateRect(nil,false); + end + property checked:bool read FcheckState write setChecked; + property leftText:bool read FleftText write setLeftText; + {** + @param(checked)(integer)勾选状态: + 0:未选中。 + 1:选中。 + @param(leftText)(bool)文本是否在左%% + **} + private + FleftText; + FcheckState; + FCheckRect; + private + function drawchekd(r);virtual; + begin + if r then + begin + dc := Canvas; + dc.pen.style := PS_SOLID; + dc.brush.color := rgb(200,0,0); + dc.Draw("framecontrol",array(r[0:1],r[2:3]),DFC_BUTTON,(checked)?DFCS_CHECKED:DFCS_BUTTONCHECK); + end + end + function setChecked(v);virtual; + begin + nv := v?true:false; + if nv<>FcheckState then + begin + FcheckState := nv; + if handleAllocated() then _send_(BM_SETCHECK,FcheckState,0); + end + end + function setLeftText(v); + begin + nv := v?true:false; + if FleftText<>nv then + begin + FleftText := nv; + InvalidateRect(nil,false); + end + end + function GetBtnTextRect();virtual; + begin + r := ClientRect; + h := r[3]-r[1]; + dh := integer( (h-16)/2)+1; + if FleftText then + begin + FCheckRect := array(r[2]-18,r[1]+dh,r[2]-2,r[3]-dh); + r[2] -=20; + end else + begin + FCheckRect := array(r[0]+2,r[1]+dh,r[0]+18,r[3]-dh); + r[0] +=20; + end + return r; + end +end +type tcustomradiobtn = class(tcustomcheckbtn) + {** + @explan(说明)radiobtn单选按钮控件 + **} + function create(AOwner); + begin + inherited; + end + function InitializeWnd();override; + begin + inherited; + ck := checked; + if ck then + _send_(BM_SETCHECK,ck,0); + end + function click();override; + begin + if checked then + begin + _send_(BM_CLICK,0,0); + end else + inherited; + end + function BMSETCHECK(o,e):BM_SETCHECK;override; + begin + t := e.wparam; + inherited; + if t then + begin + p := parent ; + ctls := p.Controls; + for i := 0 to ctls.count-1 do + begin + ci := ctls[i]; + if ci is class(tcustomradiobtn) then + begin + if ci=self(true) then continue; + if ci.checked then + begin + ci.checked := false; + end + end + end + end + end + + private + function drawchekd(r);override; + begin + if r then + begin + dc := Canvas; + dc.pen.style := PS_SOLID; + dc.brush.color := rgb(200,0,0); + dc.Draw("framecontrol",array(r[0:1],r[2:3]),DFC_BUTTON,DFCS_BUTTONRADIO); + if checked then + begin + r2 := array(r[0:1]+3,r[2:3]-3); + dc.brush.color := 0; + dc.draw("ellipse",r2); + end + end + end +end type teditable=class(TSLUIBASE) private FInsertState; @@ -1892,12 +2297,6 @@ type tcustomedit=class(TCustomControl) if FEditable then FEditable.Recycling(); FEditable := nil; end - function publishs();override; - begin - return array("name","align","anchors","font","enabled","popupmenu","visible","height","width","left","top","text","placeholder" - ,"readonly","limitlength","linewrap","tabstop","onmousemove","onpopupmenu","onmousedown","onmouseup","onkeyup" - ,"onkeydown","onkeypress","onmaxtext","onkillfocus","onsetfocus","onchange"); - end property text:string read getentrytext write setentrytext; property onmaxtext:eventhandler read Fonmaxtext write fonmaxtext; property onupdate read FOnUpdate write FOnUpdate; @@ -1906,7 +2305,7 @@ type tcustomedit=class(TCustomControl) property limitlength:integer read getlimitlength write setLimitLength; property LineWrap:bool read getLineWrap write setLineWrap; property placeholder:string read getplaceholder write Setplaceholder; - property Border read getBorder write SetBorder; + property Border:bool read getBorder write SetBorder; {** @param(LineWrap)(bool)自动换行,默认为false不自动换行%% @param(onmaxtext)(fpointer)达到文本最大回调%% @@ -1969,6 +2368,41 @@ type tcustomedit=class(TCustomControl) FOnChange; fonmaxtext; end +type tcustompassword = class(tcustomedit) + {** + @explan(说明) 密码编辑框类 %% + **} + private + function SetPassWordChar(v); + begin + return ExecuteCommand("ecpasswordchar",v); + end + function getPassWordChar(); + begin + return ExecuteCommand("ecpasswordchar"); + end + public + function create(owner);override; + begin + inherited; + ExecuteCommand("ecmarked",true); + Left := 10; + Top := 10; + Width := 80; + Height := 25; + caption := "tpassword"; + end + function KeyDown(o,e);override; + begin + if ( ssCtrl in e.shiftstate) and (ord("C")=e.CharCode) then + begin + return ; + end + inherited; + end + property PassWordChar:string read getPassWordChar write SetPassWordChar; + +end type tthreeEntry=class(TCustomControl) private type tpickerEditer=class(teditable) @@ -2996,16 +3430,6 @@ type TcustomListBox=class(TCustomListBoxbase) property Multisel:bool read FMultisel write SetMultisel; property onSelectionChange:eventhandler read FselectionChange write FselectionChange; property Items:strings read GetData write setData; - function publishs();override; - begin - return array("name","caption","anchors","align","enabled", - "font","visible","border","color", - "height","width","left","top","items", - "multisel","popupmenu","wsdlgmodalframe", - "onmousedown","onmouseup", - "onselectionchange" - ); - end protected function CheckListItems(s); begin @@ -3506,14 +3930,6 @@ type TcustomComboBox=class(TCustomComboBoxbase) {** @param(oneditchanged)(function[tcomboBox,tuieventbase])文本被改变回调,文本显示后调用%% **} - function publishs();override; - begin - return array("name","font","border", - "visible","anchors","align","enabled", - "height","width","left","top", - "readonly","itemindex", - "items","oncloseup","ondropdown","onselchanged","oneditchanged","oneditupdate"); - end function setReadOnly(v); begin nv := v?true:false; @@ -3604,10 +4020,6 @@ type TcustomToolButton=class(tcomponent) **} if parent and parent.HandleAllocated()then return parent.GetItemRect(self); end - function publishs();override; - begin - return array("name","caption","enabled","stylesep","imageid","visible","onclick","popupmenu"); - end function Recycling();override; begin if FToolbar then @@ -4206,18 +4618,6 @@ type TcustomToolBar=class(TCustomControl) CalcButtonsRect(); InvalidateRect(nil,false); end - function publishs();override; - begin - return array("name","align","caption","enabled","font","left","top","width","height", - "visible","imagelist"); - if Align <> alNone then - begin - return array("name","align","caption","enabled","font", - "visible","imagelist"); - end else - return array("name","align","caption","enabled","font","left","top","width","height", - "visible","imagelist"); - end protected procedure SetAlign(Value:TAlign);override; begin @@ -4371,6 +4771,134 @@ type TcustomToolBar=class(TCustomControl) FMouseDownIdx; FWillModifyToolbar; end +type TcustomStatusBar=class(TCustomControl) + {** + @explan(说明) 状态栏 %% + **} + private + Fitems; + FCwid; + FCHei; + function itemidok(id); + begin + ct := length(Fitems); + return id >= 0 and id0 and wd<1.0001 then + begin + wd *= FCwid; + end + DrawStatItem(cvs,v,array(p,0,p+wd,FCHei)); + p += wd; + if p>FCwid then return; + end + end + if p0)then wd := 100; + Fitems[Length(Fitems)]:= array("text":str,"width":wd); + if HandleAllocated()then + begin + InvalidateRect(nil,false); + end + end + function deleteitem(id); + begin + {** + @explan(说明) 删除项目 %% + @param(id)(integer) 序号 %% + **} + if not(itemidok(id))then return-1; + deleteindex(Fitems,id,true); + if HandleAllocated()then + begin + InValidateRect(nil,false); + end + end + function setitemtext(str,id); + begin + {** + @explan(说明) 修改字段 %% + @param(str)(string) 文本%% + @param(id)(integer) 序号 %% + **} + if not ifstring(str)then return-1; + if not(itemidok(id))then return-1; + Fitems[id,"text"]:= str; + if HandleAllocated()then + begin + InvalidateRect(nil,false); + end + end + property Items:statusitems read Fitems Write SetItems; + {** + @param(Items)(array)设置项 ,二维数组包括 text ,width 两个字段 array(("text":"abc","width":200),("text":"part2","width":0.4))%% + **} +end type TCustomSpinEdit = class(TCustomControl) {** @explan(说明)spinedit控件 @@ -4630,6 +5158,680 @@ type TCustomSpinEdit = class(TCustomControl) @param(OnDecrease)(function[TCustomSpinEdit,tuieventbase]) 减少时的回调 %% **} end +type tcustomgroupbox=class(TCustomControl) + function create(owner);override; + begin + inherited; + Left := 10; + Top := 10; + Width := 185; + Height := 105; + caption := "group"; + Color := rgb(240,240,240); + FtextPosition := 0; + end + function Paint();override; + begin + c := caption; + if Parent and ParentFont then + begin + ft := Parent.Font; + end else + ft := Font; + wf := ft.width; + hf := ft.height+2; + cvs := Canvas; + cvs.pen.color := rgb(170,170,170); + cvs.pen.width := 1; + cwd := 0; + if c then + begin + cwd := wf * length(c)+1; + end + rc := ClientRect; + hf2 := integer(hf/2); + /////////////////////////////////////// + cvs.moveto(array(3,hf2)); + cvs.LineTo(array(3,rc[3]-3)); + cvs.LineTo(array(rc[2]-3,rc[3]-3)); + cvs.LineTo(array(rc[2]-3,hf2)); + cvs.LineTo(array(3,hf2)); + /////////////////////////////////////// + ///////////////////////////////////////// + txpos := 10; + if c then + begin + if cwd<(rc[2]-rc[0]-20)then + begin + case FtextPosition of + 2: + begin + txpos := 10+integer((rc[2]-rc[0]-20-cwd)/2); + end + 3: + begin + txpos := rc[2]-rc[0]-10-cwd; + end + end; + end + cvs.pen.color := Color; + cvs.moveto(array(txpos-1,hf2)); + cvs.LineTo(array(txpos+cwd+1,hf2)); + cvs.textout(c,array(txpos,0)); + end + drawdesigninggrid(); + ///////////////////////////////// + end + property textPos:AlignStyle9 read FtextPosition write setTextPosition; + private + function setTextPosition(n); + begin + if(n in array(0,1,2,3))and n <> FtextPosition then + begin + FtextPosition := n; + InvalidateRect(nil,false); + end + end + FtextPosition; +end +type tcustomprogressbar=class(TCustomControl) + {** + @explan(说明) 进度栏 + 进度栏是显示任务进行完成度的控件。进度栏的上下限是进度条位置可移动的 + 范围,可以通过range属性获取、修改,其默认值是array(0,100)。进度条的位置可以通过 + position属性获取、修改。进度栏的步增量是其每次调用increaseByStep函数进度条 + 位置移动的量,可以通过step属性获取、修改,其默认值是10. + 进度条默认是分段离散的,可通过修改smooth成员设置其为平滑连续的。默认是 + 水平从左到右移动,可通过修改vertical成员来设置其为垂直从底部到顶部移动。 + **} + public + function create(AOwner);override; + begin + inherited; + Caption:="prograssbar"; + FLeft := 10; + FTop := 10; + Width := 150; + Height :=20; + Fsmooth:=0; + Fvertical:=0; + Frange:=array(0,100); + Fposition:=0; + Fstep:=10; + FbarColor:=0xD77800; + color:=0xf0f0f0; + end + function isContainer(cd);override; + begin + return 0; + end + function paint();override; + begin + inherited; + dc := Canvas; + r := ClientRect; + h := r[3]-r[1]; + w := r[2]-r[0]; + br := r; + rt := (Fposition/(Frange[1]-Frange[0])); + if Fvertical then + begin + d := rt *h; + br[0] +=(h-d); + end else + begin + d := floor(rt*w); + br[2] := br[0]+d; + end + dc.brush.color := FbarColor; + dc.FillRect(br); + end + function increaseByStep();begin + {** + @explan(说明)按照步增量移动进度条当前的位置,当其超过限度则设置位置至下限以便于从头重新开始%% + @return(integer)先前的位置,出错返回-1%% + **} + r:=Fposition; + Fposition+= Fstep; + if Fposition>Frange[1] then + Fposition := Frange[0]; + else if Fposition0 then + begin + setPosition(n*Fstep); + end + return r; + end + property smooth:bool read Fsmooth write setSmooth; + property vertical:bool read Fvertical write setVertical; + {** + @param(smooth)(bool)进度条平滑移动%% + @param(vertical)(bool)进度条垂直移动%% + **} + property range:pairint read Frange write setRangeA; + property position:integer read Fposition write setPosition; + property stepincrement:integer read Fstep write setStep; + property barColor:color read FbarColor write setIndicatorBarColor; + {** + @param(range)(array of integer)进度栏的上下限%% + @param(position)(integer)进度条的位置%% + @param(stepincrement)(integer)进度栏的步增量%% + **} + + private + Fsmooth; + Fvertical; + Frange; + Fposition; + Fstep; + FbarColor; + private + function setSmooth(n); + begin + Fsmooth := n; + end + function setVertical(n); + begin + nv := n?true:false; + if nv = Fvertical then return ; + Fvertical := nv; + InvalidateRect(nil,false); + end + function isValidPosition(n); + begin + return n>=Frange[0] and n<=Frange[1]; + end + function isValidColorValue(n); + begin + if ifint(n) then + return not (n.&0xFF000000); + else + if ifint64(n) then + return not (n.&0xFFFFFFFFFF000000); + else return 0; + end + function setRange(l,h);begin + {** + @explan(说明)设置进度栏的上下限,要求上限高于下限且皆非负%% + @param(l)(integer)下限%% + @param(h)(integer)上限%% + @return(integer)1:成功;0:失败;-1:出错%% + **} + if Frange=array(l,h) then return ; + if ifnumber(l) and ifnumber(h) and l>=0 and h>=l+1 then + begin + l:=integer(l); + h:=integer(h); + Frange:=array(l,h); + Fposition:=Fpositionh?h:Fposition); + return 1; + end + + end + function setRangeA(arr);begin + return setRange(arr[0],arr[1]); + end + function setPosition(n); + begin + {** + @explan(说明)设置进度条位置,当其超过限度则设置位置至该限度%% + @param(n)(integer)要设置的位置%% + @return(integer)先前位置,出错则返回-1%% + **} + r := Fposition; + if ifnumber(n) and isValidPosition(n) then + begin + Fposition:=n; + InvalidateRect(nil,false); + end + return r; + end + function setStep(n);begin + {** + @explan(说明)设置进度栏步增量%% + @param(n)(integer)要设置的值%% + @return(integer)1:成功;0:失败;-1:出错%% + **} + if Fstep=n then return ; + d := Frange[1]-Frange[0]; + if ifnumber(n) and n<=d then + begin + Fstep:=integer(n); + InvalidateRect(nil,false); + return 1; + end + end + function setIndicatorBarColor(clr); + begin + {** + @explan(说明)设置进度条颜色%% + @param(clr)(integer)要设置的颜色的rgb值%% + @return(integer)1:成功;0:失败;-1:出错%% + **} + if ifnumber(clr) and FbarColor<>clr and isValidColorValue(clr) then + begin + FbarColor:=integer(clr); + InvalidateRect(nil,false); + return 1; + end + end +end +type tcustomipaddr = class(TCustomControl) + {** + @explan(说明) ip控件 %% + **} + private + type tipeditor = class(teditable) + function create(); + begin + inherited; + border := false; + FRange := array(0,1); + UnLocked := true; + end + function doonmaxtext();override; + begin + if FNext and Fnext.Visible then + begin + KillFocus(); + ExecuteCommand("ecclcsel"); + FNext.SetFocus(); + FNext.ExecuteCommand("ecsel",array(1,10)); + end + end + function doOnChange();override; + begin + if host and UnLocked then + begin + host.DoIpChanged(); + end + end + function GoToPrev(); + begin + if FPrev then + begin + KillFocus(); + ExecuteCommand("ecclcsel"); + FPrev.SetFocus(); + FPrev.ExecuteCommand("ecsel",array(10,1)); + end + end + function WMCHAR(o,e);override; + begin + case e.char of + "0" to "9" : + begin + inherited; + end + " ","\t",".": + begin + doonmaxtext(); + end + chr(VK_BACK): + begin + inherited; + idx := ExecuteCommand("eccaretpos"); + if idx=1 then return GoToPrev(); + end + end + end + function WMKEYDOWN(o,e);override; + begin + case e.CharCode of + VK_LEFT: + begin + idx := ExecuteCommand("eccaretpos"); + if idx=1 then return GoToPrev(); + end + VK_RIGHT: + begin + idx := ExecuteCommand("eccaretpos"); + if idx>length(self.Text) then + begin + return doonmaxtext(); + end + end + end ; + inherited; + end + function GetNumValue(); + begin + t := Text; + r := StrToIntDef(t,FRange[0]); + return r; + end + function GetTureText(); + begin + return Inttostr(GetNumValue()); + end + function SetNumValue(v); + begin + if v<=FRange[0] then return text := inttostr(FRange[0]); + if v>=FRange[1] then return text := inttostr(FRange[1]); + if vFRange[0] then text := inttostr(v); + end + function SetRange(a,b); + begin + if a>=0 and b>a then + begin + if a <> FRange[0] or b<>FRange[1] then + begin + FRange := array(a,b); + L := 1; + while 10^L=0 and i<=4 then + FEditors[integer(i)].SetRange(low,high); + end + function DoControlAlign();override; + begin + calcportsize(); + end + function MouseUp(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then + return v.MouseUp(o,e); + end + return inherited; + end + function MouseMove(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then + return v.MouseMove(o,e); + end + return inherited; + end + function MouseDown(o,e);override; + begin + if csDesigning in ComponentState then return ; + idx := -1; + for i,v in FEditors do + begin + if pointinrect(e.pos,v.GetEntryRect()) then + begin + idx := i; + //v.MouseDown(o,e); + end else v.KillFocus(); + end + if idx>=0 then return FEditors[idx].MouseDown(o,e); + return inherited; + end + function dosetfocus(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then return v.SetFocus(); + end + for i,v in FEditors do + begin + return v.SetFocus(); + end + inherited; + end + function dokillfocus(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then return v.killFocus(); + end + inherited; + end + function keypress(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then return v.WMCHAR(o,e); + end + + inherited; + end + function KeyDown(o,e);override; + begin + if csDesigning in ComponentState then return ; + for i,v in FEditors do + begin + if v.HasFocus then return v.WMKEYDOWN(o,e); + end + inherited; + end + + function Recycling();override; + begin + FaddrChange := nil; + FIpe1 := nil; + FIpe2 := nil; + FIpe3 := nil; + FIpe4 := nil; + FPort := nil; + for i,v in FEditors do v.Recycling(); + FEditors := array(); + inherited; + end + property HasPort:bool read FHasPort write SetHasPort; + property ipaddr:string read getAddress write setAddress; + property onAddrChange:eventhandler read FaddrChange write FaddrChange; + {** + @param(ipaddr)(string)ip地址%% + @param(onAddrChange)(function[tIPAddr,tuieventbase])id地址变化回调%% + **} + private + FEditors; + FHasPort; + FIpe1; + FIpe2; + FIpe3; + FIpe4; + FPort; + FFontwidth; + FaddrChange; + Fsynrects; + function getAddress(); + begin + r := ""; + for i:= 0 to 3 do + begin + r+=FEditors[i].GetTureText(); + if i<3 then r+="."; + end + if FHasPort then + begin + r += ":"+ FPort.GetTureText(); + end + return r; + end + function setAddress(v); + begin + if not ifstring(v) then return ; + r := getAddress(); + v1 := str2array(v,":"); + vs := str2array(v1[0],"."); + fipe1.UnLocked := false; + for i:=0 to min(length(vs)-1,3) do + FEditors[i].SetNumValue(StrToIntDef(vs[i],0)); + if v1[1] then + begin + FPort.SetNumValue(StrToIntDef(v1[1],0)) ; + end + fipe1.UnLocked := true; + r1 := getAddress(); + if r<>r1 then + begin + DoIpChanged(); + end + end + function SetHasPort(v); + begin + nv := v?true:false; + if FHasPort <>nv then + begin + FHasPort := nv; + + calcportsize(); + FPort.Visible := nv; + InvalidateRect(nil,false); + end + end + function calcportsize(); + begin + if not( FIpe1 and FIpe2 and FIpe3 and FIpe4 and FPort) then return ; + rc := ClientRect; + wd := rc[2]-rc[0]-2; + h := rc[3]-rc[1]-2; + if wd<56 then return ; + ewd := integer((wd-FFontwidth*(3+FHasPort)-10)/(4+FHasPort)); + rc1 := array(1,1,ewd,h); + FIpe1.ClientRect := rc1; + rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); + FIpe2.ClientRect := (rc1); + rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); + FIpe3.ClientRect := (rc1); + if FHasPort then rc1 := array(rc1[2]+FFontwidth+1,1,rc1[2]+FFontwidth+ewd,h); + else + rc1 := array(rc1[2]+FFontwidth+1,1,rc[2],h); + FIpe4.ClientRect := (rc1); + if FHasPort then + begin + rc1 := array(rc1[2]+FFontwidth+1,1,rc[2],h); + FPort.ClientRect := (rc1); + FPort.visible := true; + end + Fsynrects := array(); + wd+=2; + ewd := integer((wd-FFontwidth*(3+FHasPort)-10)/(4+FHasPort)); + rc1 := rc; + rc1[1] := integer(rc1[3]/5); + rc1[0]:= (FIpe1.ClientRect)[2];; + rc1[2] := rc1[0]+FFontwidth; + Fsynrects[0][0] := "."; + Fsynrects[0][1] := rc1; + rc1[0]:= (FIpe2.ClientRect)[2]; + rc1[2] := rc1[0]+FFontwidth; + Fsynrects[1,0] := "."; + Fsynrects[1,1] := rc1; + rc1[0]:= (FIpe3.ClientRect)[2];; + rc1[2] := rc1[0]+FFontwidth; + Fsynrects[2,0] := "."; + Fsynrects[2,1] := rc1; + rc1[0]:= (FIpe4.ClientRect)[2];; + rc1[2] := rc1[0]+FFontwidth; + Fsynrects[3,0] := ":"; + Fsynrects[3,1] := rc1; + end + +end + implementation type TtoolbuttonActionLink=class(TControlActionLink) {** @@ -4713,6 +5915,7 @@ type TTipWnd=class(TCustomControl) //tip private FSize; end + initialization {$ifdef linux} class(tUIglobalData).uisetdata("G_T_TTIMER_",class(TCustomTimer));