parent
4519cff2a0
commit
9755b27f72
|
|
@ -570,7 +570,7 @@ type TDComponent = class()
|
||||||
end
|
end
|
||||||
return nn;
|
return nn;
|
||||||
end
|
end
|
||||||
function SetDefalutEvent(ev);
|
function SetDefalutEvent(ev,ndf);
|
||||||
begin
|
begin
|
||||||
if ifarray(ev) then
|
if ifarray(ev) then
|
||||||
hs := createtslfunction(ev);
|
hs := createtslfunction(ev);
|
||||||
|
|
@ -583,7 +583,8 @@ type TDComponent = class()
|
||||||
if CheckTslCode(r,err) then
|
if CheckTslCode(r,err) then
|
||||||
begin
|
begin
|
||||||
feventnametable[ev["event"]] := ev;
|
feventnametable[ev["event"]] := ev;
|
||||||
FDefaultEvent := ev["event"];
|
if not ndf then
|
||||||
|
FDefaultEvent := ev["event"];
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
|
|
@ -2517,7 +2518,7 @@ type TDListView = class(TDComponent)
|
||||||
DefaultEvent := array(
|
DefaultEvent := array(
|
||||||
"event":"onselchanged",
|
"event":"onselchanged",
|
||||||
"name":"sel",
|
"name":"sel",
|
||||||
"param":array("o"),
|
"param":array("o","e"),
|
||||||
"virtual":true,
|
"virtual":true,
|
||||||
"body":
|
"body":
|
||||||
"
|
"
|
||||||
|
|
@ -2532,6 +2533,68 @@ type TDListView = class(TDComponent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
type TDgridctl = class(TDComponent)
|
||||||
|
{**
|
||||||
|
@explan(说明) 自绘制网格 设计器控件 %%
|
||||||
|
**}
|
||||||
|
function HitTip();override;
|
||||||
|
begin
|
||||||
|
return inherited;
|
||||||
|
end
|
||||||
|
function bitmapinfo();override;
|
||||||
|
begin
|
||||||
|
return getgridctlbitmapinfo();
|
||||||
|
end
|
||||||
|
function WndClass();override;
|
||||||
|
begin
|
||||||
|
return Class(TGridCtl);
|
||||||
|
end
|
||||||
|
function Create(AOwner);override;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
fiscontainerdcmp := false;
|
||||||
|
fiscontainerdcmp := false;
|
||||||
|
DefaultEvent := array(
|
||||||
|
"event":"ondrawcell",
|
||||||
|
"name":"drawcell",
|
||||||
|
"param":array("o","e"),
|
||||||
|
"virtual":true,
|
||||||
|
"body":
|
||||||
|
"
|
||||||
|
{**
|
||||||
|
@explan(说明) 绘制表格 %%
|
||||||
|
@param(o)(tlistview) grid对象 %%
|
||||||
|
@param(e)(tuieventbase) 消息对象包括,row,col,rec,cavas等属性提供绘制信息 %%
|
||||||
|
**}
|
||||||
|
//绘制表头
|
||||||
|
i := e.row;
|
||||||
|
j := e.col;
|
||||||
|
rec := e.rec;
|
||||||
|
cvs := e.canvas;
|
||||||
|
if i<o.FixedRows or j<o.FixedColumns then
|
||||||
|
begin
|
||||||
|
cvs.Draw('FrameControl',array(rec[0:1],rec[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH); //DFCS_CHECKED DFCS_FLAT
|
||||||
|
end
|
||||||
|
//绘制网格线
|
||||||
|
cvs.moveto(rec[array(2,1)]);
|
||||||
|
cvs.LineTo(rec[array(2,3)]);
|
||||||
|
cvs.LineTo(rec[array(0,3)]);
|
||||||
|
if j=0 then
|
||||||
|
begin
|
||||||
|
cvs.LineTo(rec[array(0,1)]);
|
||||||
|
end
|
||||||
|
if i=0 then
|
||||||
|
begin
|
||||||
|
cvs.MoveTo(rec[array(0,1)]);
|
||||||
|
cvs.LineTo(rec[array(2,1)]);
|
||||||
|
end
|
||||||
|
//绘制文本
|
||||||
|
cvs.drawtext(format('%d,%d',i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
|
||||||
|
inherited;
|
||||||
|
");
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
type TDedit= class(TDComponent)
|
type TDedit= class(TDComponent)
|
||||||
function HitTip();override;
|
function HitTip();override;
|
||||||
|
|
@ -2936,6 +2999,38 @@ type TDListBox=class(TDComponent)
|
||||||
function Create(AOwner);override;begin
|
function Create(AOwner);override;begin
|
||||||
inherited;
|
inherited;
|
||||||
fiscontainerdcmp := false;
|
fiscontainerdcmp := false;
|
||||||
|
DefaultEvent := array(
|
||||||
|
"event":"onselchanged",
|
||||||
|
"name":"sel",
|
||||||
|
"virtual":true,
|
||||||
|
"param":array("o","e"),
|
||||||
|
"body":
|
||||||
|
" {**
|
||||||
|
@explan(说明) item选择改变回调 %%
|
||||||
|
@param(o)(listbox) 列表控件 %%
|
||||||
|
@param(e)(tuieventbase) 消息对象 %%
|
||||||
|
**}
|
||||||
|
echo '\\r\\n',tostn(o.ItemIndex);
|
||||||
|
inherited;");
|
||||||
|
ev := array(
|
||||||
|
"event":"ondrawlist",
|
||||||
|
"name":"draw",
|
||||||
|
"virtual":true,
|
||||||
|
"param":array("o","e"),
|
||||||
|
"body":
|
||||||
|
" {**
|
||||||
|
@explan(说明) 自绘制 %%
|
||||||
|
@param(o)(listbox) 列表控件 %%
|
||||||
|
@param(e)(tlistdrawevent) 消息对象 %%
|
||||||
|
**}
|
||||||
|
id := e.idx;
|
||||||
|
cvs := e.canvas;
|
||||||
|
rec := e.rec;
|
||||||
|
sel := e.sel;
|
||||||
|
cvs.drawtext( o.getItemText(id),rec);
|
||||||
|
inherited;");
|
||||||
|
|
||||||
|
SetDefalutEvent(ev,1);
|
||||||
end
|
end
|
||||||
function bitmapinfo();override;begin
|
function bitmapinfo();override;begin
|
||||||
return "0502000000060400000074797065000203000000696D670006040000006461746
|
return "0502000000060400000074797065000203000000696D670006040000006461746
|
||||||
|
|
@ -3521,6 +3616,7 @@ begin
|
||||||
class(TDListBox),
|
class(TDListBox),
|
||||||
class(TDListView),
|
class(TDListView),
|
||||||
class(TDTreeView),
|
class(TDTreeView),
|
||||||
|
class(TDgridctl),
|
||||||
class(TDProgressBar),
|
class(TDProgressBar),
|
||||||
class(TDDateTimePicker),
|
class(TDDateTimePicker),
|
||||||
class(TDTimePicker),
|
class(TDTimePicker),
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,7 @@ function getcoolbarbitmapinfo();
|
||||||
function gettoolbarbitmapinfo();
|
function gettoolbarbitmapinfo();
|
||||||
function getlabelbitmapinfo();
|
function getlabelbitmapinfo();
|
||||||
function getlistviewbitmapinfo();
|
function getlistviewbitmapinfo();
|
||||||
|
function getgridctlbitmapinfo();
|
||||||
implementation
|
implementation
|
||||||
function getexamplesbmpinfo();
|
function getexamplesbmpinfo();
|
||||||
begin
|
begin
|
||||||
|
|
@ -1503,6 +1504,16 @@ CF7F527EA1C3DA7875C10207E7AA366E2C20907118F56AE3DA023E0ECE2A78100
|
||||||
4FA02DDADA8831B0B9AD8BCB2A0297CA9A0F59F7E7B0FE20F1D79BA1B7D429BC4
|
4FA02DDADA8831B0B9AD8BCB2A0297CA9A0F59F7E7B0FE20F1D79BA1B7D429BC4
|
||||||
0000000049454E44AE42608200";
|
0000000049454E44AE42608200";
|
||||||
end
|
end
|
||||||
|
function getgridctlbitmapinfo();
|
||||||
|
begin
|
||||||
|
return "0502000000060400000074797065000203000000696D670006040000006461746
|
||||||
|
10002A800000089504E470D0A1A0A0000000D4948445200000012000000120806
|
||||||
|
00000056CE8E57000000017352474200AECE1CE90000000467414D410000B18F0
|
||||||
|
BFC6105000000097048597300000EC300000EC301C76FA8640000003D49444154
|
||||||
|
384F63F84F25403B83A2BDB64059C4B16180FA068124C9C13030EA35125C04031
|
||||||
|
41B04922407C3C0A8D74870110C50CD207201950CFAFF1F001BE56DAD54559407
|
||||||
|
0000000049454E44AE42608200";
|
||||||
|
end
|
||||||
function getsplitterbitmapinfo();
|
function getsplitterbitmapinfo();
|
||||||
begin
|
begin
|
||||||
return "0502000000060400000074797065000203000000696D670006040000006461746
|
return "0502000000060400000074797065000203000000696D670006040000006461746
|
||||||
|
|
|
||||||
|
|
@ -753,12 +753,7 @@ type tcontrol = class(tcomponent)
|
||||||
e.SetButton(mbLeft);
|
e.SetButton(mbLeft);
|
||||||
e.setshiftdouble(ssDouble);
|
e.setshiftdouble(ssDouble);
|
||||||
CallMessgeFunction(FOnMouseDown,o,e);
|
CallMessgeFunction(FOnMouseDown,o,e);
|
||||||
MouseDown(o,e);
|
MouseDown(o,e);
|
||||||
return;
|
|
||||||
if not(e.skip)then
|
|
||||||
begin
|
|
||||||
CallMessgeFunction(FOnDblClick,o,e);
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function WMRButtonDBLCLK(o,e):LM_RBUTTONDBLCLK;virtual;
|
function WMRButtonDBLCLK(o,e):LM_RBUTTONDBLCLK;virtual;
|
||||||
begin
|
begin
|
||||||
|
|
@ -796,10 +791,6 @@ type tcontrol = class(tcomponent)
|
||||||
e.SetButton(mbRight);
|
e.SetButton(mbRight);
|
||||||
CallMessgeFunction(FOnMouseUp,o,e);
|
CallMessgeFunction(FOnMouseUp,o,e);
|
||||||
MouseUp(o,e);
|
MouseUp(o,e);
|
||||||
if not e.skip then
|
|
||||||
begin
|
|
||||||
CallMessgeFunction(FOnrbuttonup,o,e); //右键点击
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
function WMMButtonUp(o,e):LM_MBUTTONUP;virtual;
|
function WMMButtonUp(o,e):LM_MBUTTONUP;virtual;
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -1474,7 +1474,7 @@ type TVCForm = class(TScrollingWinControl)
|
||||||
"onsize","onmove","onmousemove",
|
"onsize","onmove","onmousemove",
|
||||||
"onmousedown","onmouseup",
|
"onmousedown","onmouseup",
|
||||||
"onactivate","onclose",
|
"onactivate","onclose",
|
||||||
"onsetfocus","onkillfocus",
|
"onsetfocus","onkillfocus","onpopupmenu",
|
||||||
"onkeyup","onkeydown","onkeypress","onnotification"
|
"onkeyup","onkeydown","onkeypress","onnotification"
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
|
|
@ -2228,10 +2228,11 @@ type TListBox = class(TcustomListBox)
|
||||||
begin
|
begin
|
||||||
return array("name","caption","anchors","align","enabled",
|
return array("name","caption","anchors","align","enabled",
|
||||||
"font","visible","border","color",
|
"font","visible","border","color",
|
||||||
"height","width","left","top","items",
|
"height","width","left","top",
|
||||||
"multisel","checkbox","popupmenu","wsdlgmodalframe",
|
"itemheight","items","itemindex","selbkcolor",
|
||||||
"onmousedown","onmouseup",
|
"multisel","checkbox","ownerdraw","itemcount","popupmenu","wsdlgmodalframe",
|
||||||
"onselchange","onnotification"
|
"onpopupmenu","onmousedown","onmouseup","ondrawlist",
|
||||||
|
"onselchanged","onnotification"
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -2330,7 +2331,7 @@ type TColorbox=class(TcustomListBox)
|
||||||
"visible","border","enabled",
|
"visible","border","enabled",
|
||||||
"height","width","left","top",
|
"height","width","left","top",
|
||||||
"wsdlgmodalframe","popupmenu","parentcolor","parentfont",
|
"wsdlgmodalframe","popupmenu","parentcolor","parentfont",
|
||||||
"onmousedown","onmouseup",
|
"onpopupmenu","onmousedown","onmouseup",
|
||||||
"onselchanged","onnotification"
|
"onselchanged","onnotification"
|
||||||
);
|
);
|
||||||
end
|
end
|
||||||
|
|
@ -2976,7 +2977,7 @@ type tpagecontrol = class(tcustompagecontrol)
|
||||||
begin
|
begin
|
||||||
return array("name","left","top","width","height",
|
return array("name","left","top","width","height",
|
||||||
"align","anchors","color","font","parentcolor","parentfont","border","caption","popupmenu","enabled","visible","cursel","cursor",
|
"align","anchors","color","font","parentcolor","parentfont","border","caption","popupmenu","enabled","visible","cursel","cursor",
|
||||||
"wsdlgmodalframe","wssizebox","onselchange","onnotification");
|
"wsdlgmodalframe","wssizebox","onpopupmenu","onselchange","onnotification");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
//¶þ·Ö¿Ø¼þ
|
//¶þ·Ö¿Ø¼þ
|
||||||
|
|
@ -3009,7 +3010,7 @@ type TPairSplitterSide=class(TCustomControl)
|
||||||
end
|
end
|
||||||
function publishs();override;
|
function publishs();override;
|
||||||
begin
|
begin
|
||||||
return array("name","border","caption","color","font","parentcolor","parentfont","popupmenu","bkbitmap","wsdlgmodalframe","onsize","onnotification");
|
return array("name","border","caption","color","font","parentcolor","parentfont","popupmenu","bkbitmap","wsdlgmodalframe","onpopupmenu","onsize","onnotification");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
type TPairSplitter=class(tcustomcontrol) //
|
type TPairSplitter=class(tcustomcontrol) //
|
||||||
|
|
@ -3324,17 +3325,20 @@ type TTlvnActiveEvent=class(tuieventbase)
|
||||||
FNmList;
|
FNmList;
|
||||||
function _getvalue_(n);
|
function _getvalue_(n);
|
||||||
begin
|
begin
|
||||||
return FNmList._getvalue_(n);
|
//return FNmList._getvalue_(n);
|
||||||
|
return FNmList[n];
|
||||||
end
|
end
|
||||||
function _setvalue_(n,v);
|
function _setvalue_(n,v);
|
||||||
begin
|
begin
|
||||||
return FNmList._setvalue_(n,v);
|
//return FNmList._setvalue_(n,v);
|
||||||
|
FNmList[n] := v;
|
||||||
end
|
end
|
||||||
public
|
public
|
||||||
function create(m,w,l,h);override;
|
function create(m,w,l,h);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
FNmList := new ttagNMLISTVIEW(l);
|
FNmList := array();
|
||||||
|
//FNmList := new ttagNMLISTVIEW(l);
|
||||||
end
|
end
|
||||||
property hdr index "hdr" read _getvalue_ write _setvalue_;
|
property hdr index "hdr" read _getvalue_ write _setvalue_;
|
||||||
property iitem index "iitem" read _getvalue_ write _setvalue_;
|
property iitem index "iitem" read _getvalue_ write _setvalue_;
|
||||||
|
|
@ -3345,7 +3349,7 @@ type TTlvnActiveEvent=class(tuieventbase)
|
||||||
property ptaction index "ptaction" read _getvalue_ write _setvalue_;
|
property ptaction index "ptaction" read _getvalue_ write _setvalue_;
|
||||||
property lparam index "lparam" read _getvalue_ write _setvalue_;
|
property lparam index "lparam" read _getvalue_ write _setvalue_;
|
||||||
end
|
end
|
||||||
type ttagNMLISTVIEW=class(tslcstructureobj)
|
{type ttagNMLISTVIEW=class(tslcstructureobj)
|
||||||
private
|
private
|
||||||
static SSTRUCT;
|
static SSTRUCT;
|
||||||
class function getstruct()
|
class function getstruct()
|
||||||
|
|
@ -3371,12 +3375,22 @@ type ttagNMLISTVIEW=class(tslcstructureobj)
|
||||||
begin
|
begin
|
||||||
inherited create(getstruct(),ptr);
|
inherited create(getstruct(),ptr);
|
||||||
end
|
end
|
||||||
end
|
end}
|
||||||
type TGridCtl = class(TcustomGridCtl)
|
type TGridCtl = class(TcustomGridCtl)
|
||||||
function create(AOwner);override;
|
function create(AOwner);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
|
function publishs();override;
|
||||||
|
begin
|
||||||
|
return array("name","height","width","left","top","border","anchors","align","font","color","parentcolor","parentfont",
|
||||||
|
"autoscroll","columncount","itemcount",
|
||||||
|
"itemheight","mousesizecell","fixedrows","fixedcolumns",
|
||||||
|
"columnheader","columns",
|
||||||
|
"ondrawcell","onmousewheel","onmousemove",
|
||||||
|
"onmousedown","onmouseup","ondblclick",
|
||||||
|
"onkeyup","onkeydown","onkeypress","onnotification");
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
type TGRidBase = class(TGridCtl)
|
type TGRidBase = class(TGridCtl)
|
||||||
|
|
@ -3389,6 +3403,9 @@ type TGRidBase = class(TGridCtl)
|
||||||
FonColumnClick;
|
FonColumnClick;
|
||||||
FColumTexts;
|
FColumTexts;
|
||||||
private
|
private
|
||||||
|
function setcolumncount(n);override;
|
||||||
|
begin
|
||||||
|
end
|
||||||
function SetGridLine(v);
|
function SetGridLine(v);
|
||||||
begin
|
begin
|
||||||
nv := v?true:false;
|
nv := v?true:false;
|
||||||
|
|
@ -3640,8 +3657,7 @@ type TGRidBase = class(TGridCtl)
|
||||||
begin
|
begin
|
||||||
if not HandleAllocated()then return;
|
if not HandleAllocated()then return;
|
||||||
//¹¹ÔìÏûÏ¢¶ÔÏó
|
//¹¹ÔìÏûÏ¢¶ÔÏó
|
||||||
hd := self.Handle;
|
e := new TGRIDMDRAWITEM(WM_DRAWITEM,0,0,0);
|
||||||
e := new TGRIDMDRAWITEM(WM_DRAWITEM,0,0,hd);
|
|
||||||
e.canvas := cvs;
|
e.canvas := cvs;
|
||||||
if FColumHeader then e.itemid := i-1;
|
if FColumHeader then e.itemid := i-1;
|
||||||
else e.itemid := i;
|
else e.itemid := i;
|
||||||
|
|
@ -3664,7 +3680,7 @@ type TGRidBase = class(TGridCtl)
|
||||||
begin
|
begin
|
||||||
rc := e.rcitem;
|
rc := e.rcitem;
|
||||||
dc := e.canvas;
|
dc := e.canvas;
|
||||||
dc.Pen.Color := rgb(200,200,200);
|
dc.Pen.Color := 0xc8c8c8;
|
||||||
dc.moveto(array(rc[2],rc[1]));
|
dc.moveto(array(rc[2],rc[1]));
|
||||||
dc.LineTo(array(rc[2],rc[3]));
|
dc.LineTo(array(rc[2],rc[3]));
|
||||||
dc.LineTo(array(rc[0],rc[3]));
|
dc.LineTo(array(rc[0],rc[3]));
|
||||||
|
|
@ -4367,9 +4383,9 @@ type TListView = class(TDrawGrid)
|
||||||
function publishs();override;
|
function publishs();override;
|
||||||
begin
|
begin
|
||||||
return array("name","height","width","left","top","border","anchors","align","font","color","parentcolor","parentfont",
|
return array("name","height","width","left","top","border","anchors","align","font","color","parentcolor","parentfont",
|
||||||
"autoscroll","itemcount","itemheight","mousesizecell",
|
"autoscroll","itemheight","columns","columncount","itemcount","mousesizecell",
|
||||||
"fixedrows","fixedcolumns","columncount",
|
"fixedrows","fixedcolumns",
|
||||||
"gridline","columnheader","columns",
|
"gridline","columnheader",
|
||||||
"selectedid","selbkcolor","mouseonbkcolor",
|
"selectedid","selbkcolor","mouseonbkcolor",
|
||||||
"onmousewheel","onmousemove",
|
"onmousewheel","onmousemove",
|
||||||
"onmousedown","onmouseup","ondblclick",
|
"onmousedown","onmouseup","ondblclick",
|
||||||
|
|
|
||||||
|
|
@ -166,8 +166,30 @@ type TMDRAWITEM=class(tuieventbase,TtageDrawItem)
|
||||||
end
|
end
|
||||||
canvas;
|
canvas;
|
||||||
end
|
end
|
||||||
type TGRIDMDRAWITEM=class(TMDRAWITEM)
|
type TGRIDMDRAWITEM = class(tuieventbase)
|
||||||
{**
|
{**
|
||||||
|
@explan(说明) 表格控件绘制消息 %%
|
||||||
|
**}
|
||||||
|
function create(m,w,l,h);override;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
end
|
||||||
|
canvas;
|
||||||
|
itemid;
|
||||||
|
Subitemid;
|
||||||
|
rcitem;
|
||||||
|
SubItemRect;
|
||||||
|
{**
|
||||||
|
@param(canvas)(tcanvas) 画板对象 %%
|
||||||
|
@param(itemid)(integer) 行号 %%
|
||||||
|
@param(Subitemid)(integer) 列号 %%
|
||||||
|
@param(SubItemRect)(array(左上右下) ) 区域%%
|
||||||
|
@param(rcitem)(array(左上右下) ) 区域%%
|
||||||
|
**}
|
||||||
|
end
|
||||||
|
type TGRIDMDRAWITEM2=class(TMDRAWITEM)
|
||||||
|
{**
|
||||||
|
@ignore(忽略) %%
|
||||||
@explan(说明) 控件绘制消息类 %%
|
@explan(说明) 控件绘制消息类 %%
|
||||||
**}
|
**}
|
||||||
private
|
private
|
||||||
|
|
@ -183,6 +205,7 @@ type TGRIDMDRAWITEM=class(TMDRAWITEM)
|
||||||
end
|
end
|
||||||
type TMMEASUREITEM=class(tuieventbase,tslcstructureobj)
|
type TMMEASUREITEM=class(tuieventbase,tslcstructureobj)
|
||||||
{**
|
{**
|
||||||
|
@ignore(忽略) %%
|
||||||
@explan(说明) 系统控件测量消息
|
@explan(说明) 系统控件测量消息
|
||||||
**}
|
**}
|
||||||
static SFSTRUCT;
|
static SFSTRUCT;
|
||||||
|
|
|
||||||
|
|
@ -2527,10 +2527,11 @@ type TcustomCanvas = class(TSLUIBASE)
|
||||||
DT_SINGLELINE:单行显示文本,回车和换行符都不断行。
|
DT_SINGLELINE:单行显示文本,回车和换行符都不断行。
|
||||||
%%
|
%%
|
||||||
**}
|
**}
|
||||||
if not ifstring(str)then return-1;
|
if not ifstring(str)then return -1;
|
||||||
if not ifnumber(uft)then uft := DT_NOPREFIX; //默认忽略 &占位符
|
if not ifnumber(uft)then uft := DT_NOPREFIX; //默认忽略 &占位符
|
||||||
if not ifarray(rec)then rec := nil;
|
if not ifarray(rec)then rec := nil;
|
||||||
if HandleAllocated()then
|
if not str then return 0;
|
||||||
|
if HandleAllocated() then
|
||||||
begin
|
begin
|
||||||
requiregdi();
|
requiregdi();
|
||||||
if FTabLength then
|
if FTabLength then
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ uses utslvclauxiliary,utslvclmemstruct,utslvclgdi;
|
||||||
@date(20220510)
|
@date(20220510)
|
||||||
**}
|
**}
|
||||||
type TcustomGridCtl = class(tcustomscrollcontrol) //自绘制表格基类
|
type TcustomGridCtl = class(tcustomscrollcontrol) //自绘制表格基类
|
||||||
{**
|
{**
|
||||||
@explan(说明) 自绘制表格控件 %%
|
@explan(说明) 自绘制表格控件 %%
|
||||||
**}
|
**}
|
||||||
protected
|
protected
|
||||||
|
|
@ -80,11 +80,13 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
end
|
end
|
||||||
function Create(AOwner);override; //构造
|
function Create(AOwner);override; //构造
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
fcxy := array(-1,-1);
|
||||||
end
|
end
|
||||||
function AfterConstruction();override;
|
function AfterConstruction();override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
fcellsizerstate := 0;
|
||||||
Width := 300;
|
Width := 300;
|
||||||
Height := 260;
|
Height := 260;
|
||||||
FMouseSizeColumnWidth := 1;
|
FMouseSizeColumnWidth := 1;
|
||||||
|
|
@ -262,6 +264,28 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
if rec1[1]>rec[3]or rec1[3]<rec[1]or rec1[0]>rec[2]or rec1[2]<rec[0]then return false;
|
if rec1[1]>rec[3]or rec1[3]<rec[1]or rec1[0]>rec[2]or rec1[2]<rec[0]then return false;
|
||||||
InvalidateRect(rec1,false);
|
InvalidateRect(rec1,false);
|
||||||
end
|
end
|
||||||
|
function getindexbypos(x,y);//根据位置获得行列
|
||||||
|
begin
|
||||||
|
{**
|
||||||
|
@explan(说明) 根据位置获得行列%%
|
||||||
|
@param(x)(integer) x坐标 %%
|
||||||
|
@param(y)(integer) y坐标 %%
|
||||||
|
@return(0|array(r,c)) 行列 %%
|
||||||
|
**}
|
||||||
|
c := GetColIndexByPos(x);
|
||||||
|
if not(r>=0) then return 0;
|
||||||
|
r := GetRowIndexByPos(y);
|
||||||
|
if not(c>=0) then return 0;
|
||||||
|
for ii,v in FMergers do
|
||||||
|
begin
|
||||||
|
if v.CellInMerge(r,c)then
|
||||||
|
begin
|
||||||
|
cs := v.FCells ;
|
||||||
|
return array(cs[0],cs[1]);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return array(r,c);
|
||||||
|
end
|
||||||
function GetRowIndexByPos(y);virtual;
|
function GetRowIndexByPos(y);virtual;
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -270,30 +294,36 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
@return(integer) 行号
|
@return(integer) 行号
|
||||||
**}
|
**}
|
||||||
r :=-1;
|
r :=-1;
|
||||||
if y <= FMarginTop then return-1;
|
if y <= FMarginTop then return -1;
|
||||||
if FVariableRows then
|
if FVariableRows then
|
||||||
begin
|
begin
|
||||||
basex := FMarginTop-FRowWidth * GetYpos();
|
if y<FYfiexed then
|
||||||
x2 := FMarginTop;
|
begin
|
||||||
|
vi := FMarginTop;
|
||||||
|
for i:= 0 to FFixedRows do
|
||||||
|
begin
|
||||||
|
vi += FRowsHeight[i];
|
||||||
|
if vi>=y then return i;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
basex := FMarginTop-FRowHeight * GetYpos();
|
||||||
for i := 0 to FRowsHeight.length()-1 do
|
for i := 0 to FRowsHeight.length()-1 do
|
||||||
begin
|
begin
|
||||||
vi := FRowsHeight[i];
|
vi := FRowsHeight[i];
|
||||||
x2 += vi;
|
|
||||||
basex += vi;
|
basex += vi;
|
||||||
if x2 >= x then return i;
|
if basex >= y then return i;
|
||||||
if basex >= x then return i;
|
|
||||||
end
|
end
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
r := integer((y-FMarginTop)/FRowHeight);
|
r := integer((y-FMarginTop)/FRowHeight);
|
||||||
if y <= FYfiexed then
|
if y <= FYfiexed then
|
||||||
begin
|
begin
|
||||||
if r >= FItemCount then return-1;
|
if r >= FItemCount then return -1;
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
ybase := GetYPos();
|
ybase := GetYPos();
|
||||||
r += ybase;
|
r += ybase;
|
||||||
if r >= FItemCount then return-1;
|
if r >= FItemCount then return -1;
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
return r;
|
return r;
|
||||||
|
|
@ -353,16 +383,31 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
@param(i)(integer) 行号 %%
|
@param(i)(integer) 行号 %%
|
||||||
@param(j)(integer) 列号 %%
|
@param(j)(integer) 列号 %%
|
||||||
**}
|
**}
|
||||||
dr := array(rec[0:1],rec[2:3]);
|
if Fondrawcell then
|
||||||
|
begin
|
||||||
|
e := new tgriddrawcellevent(i,j,rec,cvs);
|
||||||
|
CallMessgeFunction(Fondrawcell,self(true),e);
|
||||||
|
return ;
|
||||||
|
end
|
||||||
|
//绘制表头
|
||||||
if i<FFixedRows or j<FColumFixed then
|
if i<FFixedRows or j<FColumFixed then
|
||||||
begin
|
begin
|
||||||
cvs.Draw("FrameControl",dr,DFC_BUTTON,DFCS_BUTTONPUSH); //DFCS_CHECKED DFCS_FLAT
|
cvs.Draw("FrameControl",array(rec[0:1],rec[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH); //DFCS_CHECKED DFCS_FLAT
|
||||||
end
|
end
|
||||||
else
|
//绘制网格线
|
||||||
|
cvs.moveto(rec[array(2,1)]);
|
||||||
|
cvs.LineTo(rec[array(2,3)]);
|
||||||
|
cvs.LineTo(rec[array(0,3)]);
|
||||||
|
if j=0 then
|
||||||
begin
|
begin
|
||||||
cvs.brush.Color := color;
|
cvs.LineTo(rec[array(0,1)]);
|
||||||
cvs.Draw("rectangle",dr,DFC_BUTTON,DFCS_BUTTONPUSH);
|
|
||||||
end
|
end
|
||||||
|
if i=0 then
|
||||||
|
begin
|
||||||
|
cvs.MoveTo(rec[array(0,1)]);
|
||||||
|
cvs.LineTo(rec[array(2,1)]);
|
||||||
|
end
|
||||||
|
//绘制文本
|
||||||
cvs.drawtext(format("%d,%d",i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
|
cvs.drawtext(format("%d,%d",i,j),rec,DT_VCENTER .| DT_SINGLELINE .| DT_CENTER .| DT_NOPREFIX);
|
||||||
end
|
end
|
||||||
function GetRowHeight(idx);
|
function GetRowHeight(idx);
|
||||||
|
|
@ -488,6 +533,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
cvs.pen.color := 0xc8c8c8;
|
||||||
if parta or merga then
|
if parta or merga then
|
||||||
begin
|
begin
|
||||||
DrawAllParts(cvs,parta,merga,array(FMarginLeft,FMarginTop,FXfiexed,FYfiexed));
|
DrawAllParts(cvs,parta,merga,array(FMarginLeft,FMarginTop,FXfiexed,FYfiexed));
|
||||||
|
|
@ -505,42 +551,58 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
DrawAllParts(cvs,partd,mergd,array(FXfiexed,FYfiexed,ps[2],ps[3]));
|
DrawAllParts(cvs,partd,mergd,array(FXfiexed,FYfiexed,ps[2],ps[3]));
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function MouseDown(o,e);override;
|
function WMLButtonDown(o,e);override;
|
||||||
begin
|
begin
|
||||||
|
fcellsizerstate := 0;
|
||||||
if csDesigning in ComponentState then return false;
|
if csDesigning in ComponentState then return false;
|
||||||
if e.button()<> mbLeft then return false;
|
fmouseleftdown := true;
|
||||||
if FC_CURRENT=FC_SIZE then //调整大小
|
if FC_CURRENT=FC_SIZE then //调整大小
|
||||||
begin
|
begin
|
||||||
FSizeColum := 1;
|
FSizeColum := 1;
|
||||||
_wapi.ClipCursor(FCursorRect);
|
_wapi.ClipCursor(FCursorRect);
|
||||||
|
fcellsizerstate := 1;
|
||||||
return true;
|
return true;
|
||||||
end else
|
end else
|
||||||
if FC_CURRENT=FC_SIZE2 then
|
if FC_CURRENT=FC_SIZE2 then
|
||||||
begin
|
begin
|
||||||
FSizeColum := 2;
|
FSizeColum := 2;
|
||||||
_wapi.ClipCursor(FCursorRect);
|
_wapi.ClipCursor(FCursorRect);
|
||||||
|
fcellsizerstate := 1;
|
||||||
return true;
|
return true;
|
||||||
end
|
end else
|
||||||
end
|
begin
|
||||||
function MouseUp(o,e);override;
|
//x := e.xPos;
|
||||||
|
//y := e.ypos;
|
||||||
|
//fleftdownpos := array(x,y);
|
||||||
|
//fleftdowncell := getindexbypos(x,y);
|
||||||
|
end
|
||||||
|
inherited;
|
||||||
|
end
|
||||||
|
function WMLButtonUp(o,e);override;
|
||||||
begin
|
begin
|
||||||
|
fmouseleftdown := false;
|
||||||
|
fleftdownpos := nil;
|
||||||
|
fleftdowncell := nil;
|
||||||
if FSizeColum then
|
if FSizeColum then
|
||||||
begin
|
begin
|
||||||
FSizeColum := false;
|
FSizeColum := false;
|
||||||
_wapi.ClipCursor(0);
|
_wapi.ClipCursor(0);
|
||||||
|
fcellsizerstate := 3;
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
end
|
return inherited;
|
||||||
function MouseMove(o,e);override;
|
end
|
||||||
|
|
||||||
|
function WMMouseMove(o,e);override;
|
||||||
begin
|
begin
|
||||||
if csDesigning in ComponentState then return false;
|
if csDesigning in ComponentState then return false;
|
||||||
if not FMouseSizeColumnWidth then
|
|
||||||
begin
|
|
||||||
setcursornormal();
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
y := e.yPos;
|
y := e.yPos;
|
||||||
X := e.xpos;
|
X := e.xpos;
|
||||||
|
if (FMouseSizeColumnWidth=0) then
|
||||||
|
begin
|
||||||
|
setcursornormal();
|
||||||
|
return inherited;
|
||||||
|
end
|
||||||
if FMouseSizeColumnWidth .& 1>0 then
|
if FMouseSizeColumnWidth .& 1>0 then
|
||||||
begin
|
begin
|
||||||
if x<FXfiexed then
|
if x<FXfiexed then
|
||||||
|
|
@ -561,11 +623,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
basey := FMarginTop-FRowHeight * xdx;
|
basey := FMarginTop-FRowHeight * xdx;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if(FMouseSizeColumnWidth=0)then
|
|
||||||
begin
|
|
||||||
setcursornormal();
|
|
||||||
return 0;
|
|
||||||
end
|
|
||||||
if FColsWidths.length()>0 and GetItemCount()>0 and x>(FMarginLeft+5)and y>(FMarginTop+5) {and y<(FMarginTop+FRowHeight*FFixedRows) }then
|
if FColsWidths.length()>0 and GetItemCount()>0 and x>(FMarginLeft+5)and y>(FMarginTop+5) {and y<(FMarginTop+FRowHeight*FFixedRows) }then
|
||||||
begin
|
begin
|
||||||
if FSizeColum=1 then
|
if FSizeColum=1 then
|
||||||
|
|
@ -573,6 +631,7 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
wd := FColsWidths[FCurrentSizeId];
|
wd := FColsWidths[FCurrentSizeId];
|
||||||
UpDateColumWidth(FCurrentSizeId,wd+x-FCurrentSizePos);
|
UpDateColumWidth(FCurrentSizeId,wd+x-FCurrentSizePos);
|
||||||
FCurrentSizePos := x;
|
FCurrentSizePos := x;
|
||||||
|
fcellsizerstate := 2;
|
||||||
return true;
|
return true;
|
||||||
end else
|
end else
|
||||||
if FSizeColum=2 then
|
if FSizeColum=2 then
|
||||||
|
|
@ -580,21 +639,29 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
wd := FRowsHeight[FCurrentSizeId];
|
wd := FRowsHeight[FCurrentSizeId];
|
||||||
UpDateRowWidth(FCurrentSizeId,wd+y-FCurrentSizePos);
|
UpDateRowWidth(FCurrentSizeId,wd+y-FCurrentSizePos);
|
||||||
FCurrentSizePos := y;
|
FCurrentSizePos := y;
|
||||||
|
fcellsizerstate := 2;
|
||||||
return true;
|
return true;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
if fmouseleftdown then return inherited ;
|
||||||
bx := basex;
|
bx := basex;
|
||||||
rc := ClientRect;
|
rc := ClientRect;
|
||||||
if FMouseSizeColumnWidth .& 1>0 then
|
if FMouseSizeColumnWidth .& 1>0 then
|
||||||
begin
|
begin
|
||||||
for i,v in FColsWidths.Data do
|
for i,v in FColsWidths.Data do
|
||||||
begin
|
begin
|
||||||
|
if (x-bx-v)<-4 then
|
||||||
|
begin
|
||||||
|
break;
|
||||||
|
end
|
||||||
if abs(x-bx-v)<3 then
|
if abs(x-bx-v)<3 then
|
||||||
begin
|
begin
|
||||||
|
if isinmergedcolmn(i,y+5) then break;
|
||||||
FCurrentSizeId := i;
|
FCurrentSizeId := i;
|
||||||
FCurrentSizePos := x;
|
FCurrentSizePos := x;
|
||||||
FCursorRect := array(clientToScreen(max(bx+6,rc[0]+6),y-10),clientToScreen(rc[2],y+10));
|
FCursorRect := array(clientToScreen(max(bx+6,rc[0]+6),y-10),clientToScreen(rc[2],y+10));
|
||||||
setcursorsize();
|
setcursorsize();
|
||||||
|
fcellsizerstate := 2;
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
bx += v;
|
bx += v;
|
||||||
|
|
@ -605,12 +672,18 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
bx := basey;
|
bx := basey;
|
||||||
for i,v in FRowsHeight.Data do
|
for i,v in FRowsHeight.Data do
|
||||||
begin
|
begin
|
||||||
|
if (y-bx-v)<-4 then
|
||||||
|
begin
|
||||||
|
break;
|
||||||
|
end
|
||||||
if abs(y-bx-v)<3 then
|
if abs(y-bx-v)<3 then
|
||||||
begin
|
begin
|
||||||
|
if isinmergedrow(i,x+5) then break;
|
||||||
FCurrentSizeId := i;
|
FCurrentSizeId := i;
|
||||||
FCurrentSizePos := y;
|
FCurrentSizePos := y;
|
||||||
FCursorRect := array(clientToScreen(x-10,max(rc[1]+6,bx+6)),clientToScreen(x+10,rc[3]));
|
FCursorRect := array(clientToScreen(x-10,max(rc[1]+6,bx+6)),clientToScreen(x+10,rc[3]));
|
||||||
setcursorsize2();
|
setcursorsize2();
|
||||||
|
fcellsizerstate := 2;
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
bx += v;
|
bx += v;
|
||||||
|
|
@ -619,8 +692,8 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
setcursornormal();
|
setcursornormal();
|
||||||
return false;
|
return inherited;
|
||||||
end
|
end
|
||||||
function MergeCells(cells);
|
function MergeCells(cells);
|
||||||
begin
|
begin
|
||||||
{**
|
{**
|
||||||
|
|
@ -654,20 +727,68 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
**}
|
**}
|
||||||
FMergers := array();
|
FMergers := array();
|
||||||
end
|
end
|
||||||
|
function Recycling();override;
|
||||||
|
begin
|
||||||
|
Fondrawcell := nil;
|
||||||
|
FMergers := array();
|
||||||
|
inherited;
|
||||||
|
end
|
||||||
//*******************
|
//*******************
|
||||||
property ItemCount read GetItemCount write SetItemCount;
|
property ItemCount:integer read GetItemCount write SetItemCount;
|
||||||
property ItemHeight read FRowHeight write SetRowHeigt;
|
property ItemHeight:integer read FRowHeight write SetRowHeigt;
|
||||||
property MouseSizeCell read FMouseSizeColumnWidth write FMouseSizeColumnWidth;
|
property MouseSizeCell:bool read FMouseSizeColumnWidth write setmousesizetype;
|
||||||
property FixedRows read FFixedRows write SetFixedRows;
|
property FixedRows:integer read FFixedRows write SetFixedRows;
|
||||||
property FixedColumns read FColumFixed write SetFixedColumns;
|
property FixedColumns:integer read FColumFixed write SetFixedColumns;
|
||||||
property ColumnCount read GetColumnCount;
|
property ColumnCount:integer read GetColumnCount write setcolumncount;
|
||||||
property VariableRows read FVariableRows write SetVariableRows;
|
property VariableRows read FVariableRows write SetVariableRows;
|
||||||
|
property ondrawcell:eventhandler read Fondrawcell write Fondrawcell;
|
||||||
{**
|
{**
|
||||||
@param(ItemCount)(integer) 行数 %%
|
@param(ItemCount)(integer) 行数 %%
|
||||||
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
@param(MouseSizeCell)(bool) 鼠标改变列宽 %%
|
||||||
@param(FixedRows)(integer) 固定的行数作为列标 %%
|
@param(FixedRows)(integer) 固定的行数作为列标 %%
|
||||||
**}
|
**}
|
||||||
|
protected
|
||||||
|
property cellsizerstate read fcellsizerstate;//调整大小
|
||||||
private
|
private
|
||||||
|
function isinmergedcolmn(i,y);
|
||||||
|
begin
|
||||||
|
for idx,v in FMergers do
|
||||||
|
begin
|
||||||
|
if v.c_inmerge(i,1) then
|
||||||
|
begin
|
||||||
|
r := GetRowIndexByPos(y);
|
||||||
|
if v.r_inmerge(r) then
|
||||||
|
begin
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function isinmergedrow(i,x);
|
||||||
|
begin
|
||||||
|
for idx,v in FMergers do
|
||||||
|
begin
|
||||||
|
if v.r_inmerge(i,1) then
|
||||||
|
begin
|
||||||
|
c := GetColIndexByPos(x);
|
||||||
|
if v.c_inmerge(c) then
|
||||||
|
begin
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function setmousesizetype(v);
|
||||||
|
begin
|
||||||
|
if v in array(0,1,2,3) then
|
||||||
|
begin
|
||||||
|
if v<>FMouseSizeColumnWidth then
|
||||||
|
begin
|
||||||
|
FMouseSizeColumnWidth := v;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
function GetGridMargin();
|
function GetGridMargin();
|
||||||
begin
|
begin
|
||||||
return array(FMarginLeft,FMarginTop,FMarginRight,FMarginBottom);
|
return array(FMarginLeft,FMarginTop,FMarginRight,FMarginBottom);
|
||||||
|
|
@ -785,18 +906,35 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
DoControlAlign();
|
DoControlAlign();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function clearselect();
|
||||||
|
begin
|
||||||
|
FSelBegin := 0;
|
||||||
|
fselend := 0;
|
||||||
|
end
|
||||||
function GetColumnCount();
|
function GetColumnCount();
|
||||||
begin
|
begin
|
||||||
return FColsWidths.length();
|
return FColsWidths.length();
|
||||||
end
|
end
|
||||||
|
function setcolumncount(n);virtual;
|
||||||
|
begin
|
||||||
|
if n>=0 and FColsWidths.length()<>n then
|
||||||
|
begin
|
||||||
|
vs := array();
|
||||||
|
for i := 0 to n-1 do
|
||||||
|
begin
|
||||||
|
vs[i] := 100;
|
||||||
|
end
|
||||||
|
setcolumns(vs);
|
||||||
|
clearselect();
|
||||||
|
end
|
||||||
|
end
|
||||||
function SetItemCount(ct);
|
function SetItemCount(ct);
|
||||||
begin
|
begin
|
||||||
if FItemCount <> ct and ct >= 0 then
|
if FItemCount <> ct and ct >= 0 then
|
||||||
begin
|
begin
|
||||||
FItemCount := ct;
|
FItemCount := ct;
|
||||||
if not FVariableRows then DoControlAlign();
|
if not FVariableRows then DoControlAlign();
|
||||||
|
clearselect();
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function SetRowHeigt(h);
|
function SetRowHeigt(h);
|
||||||
|
|
@ -895,6 +1033,17 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
FC_CURRENT := FC_NORMAL;
|
FC_CURRENT := FC_NORMAL;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
private
|
||||||
|
//选中
|
||||||
|
fleftdownpos;
|
||||||
|
fleftdowncell;
|
||||||
|
FSelBegin;
|
||||||
|
fselend;
|
||||||
|
fselbkcolor;
|
||||||
|
//
|
||||||
|
Fondrawcell;
|
||||||
|
fmouseleftdown;
|
||||||
|
fcellsizerstate; // 0 调整大小无关 ,1 准备拖拽 ,2 拖拽中 3 结束拖拽
|
||||||
FScroolChanged;
|
FScroolChanged;
|
||||||
FMergers;
|
FMergers;
|
||||||
FAutoScroll;
|
FAutoScroll;
|
||||||
|
|
@ -932,6 +1081,27 @@ type TcustomGridCtl = class(tcustomscrollcontrol) //
|
||||||
FCurrentSizeId;
|
FCurrentSizeId;
|
||||||
FCurrentSizePos;
|
FCurrentSizePos;
|
||||||
end
|
end
|
||||||
|
type tgriddrawcellevent = class(tuieventbase)
|
||||||
|
{**
|
||||||
|
@explan(说明)单元格绘制消息对象 %%
|
||||||
|
@param(row)(integer) 行号 %%
|
||||||
|
@param(col)(integer) 列号 %%
|
||||||
|
@param(rec)(array(左上右下)) 区域 %%
|
||||||
|
@param(canvas)(TCanvas) 画布 %%
|
||||||
|
**}
|
||||||
|
function create(r,c,rc,cvs);
|
||||||
|
begin
|
||||||
|
inherited create(0,0,0,0);
|
||||||
|
row := r;
|
||||||
|
col := c;
|
||||||
|
rec := rc;
|
||||||
|
canvas := cvs;
|
||||||
|
end
|
||||||
|
row;
|
||||||
|
col;
|
||||||
|
rec;
|
||||||
|
canvas;
|
||||||
|
end
|
||||||
implementation
|
implementation
|
||||||
type TPAINTCOUNT=class()//绘制标记
|
type TPAINTCOUNT=class()//绘制标记
|
||||||
function create(v);
|
function create(v);
|
||||||
|
|
@ -957,6 +1127,16 @@ type TMerger=class()//
|
||||||
begin
|
begin
|
||||||
return length(FCells);
|
return length(FCells);
|
||||||
end
|
end
|
||||||
|
function c_inmerge(i,f);
|
||||||
|
begin
|
||||||
|
if f then return i>=fcells[1] and i<fcells[3];
|
||||||
|
return i>=fcells[1] and i<=fcells[3];
|
||||||
|
end
|
||||||
|
function r_inmerge(i,f);
|
||||||
|
begin
|
||||||
|
if f then return i>=fcells[0] and i<fcells[2];
|
||||||
|
return i>=fcells[0] and i<=fcells[2];
|
||||||
|
end
|
||||||
function mergeid(i,j);//是否合并
|
function mergeid(i,j);//是否合并
|
||||||
begin
|
begin
|
||||||
i := FCells[0];
|
i := FCells[0];
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ private
|
||||||
FCommand :integer;
|
FCommand :integer;
|
||||||
FOnclick;
|
FOnclick;
|
||||||
fonchanged;
|
fonchanged;
|
||||||
FOwnerDraw;
|
// FOwnerDraw;
|
||||||
FOnselect;
|
FOnselect;
|
||||||
FOnDrawItem; //»æÖÆ
|
FOnDrawItem; //»æÖÆ
|
||||||
FOnMeasureItem; //²âÁ¿
|
FOnMeasureItem; //²âÁ¿
|
||||||
|
|
@ -610,7 +610,7 @@ private
|
||||||
FItems.clean();
|
FItems.clean();
|
||||||
FOnDesignClick := nil;
|
FOnDesignClick := nil;
|
||||||
FOnclick := nil;
|
FOnclick := nil;
|
||||||
FOwnerDraw := nil;
|
// FOwnerDraw := nil;
|
||||||
FOnselect := nil;
|
FOnselect := nil;
|
||||||
FOnDrawItem := nil;
|
FOnDrawItem := nil;
|
||||||
FOnMeasureItem := nil;
|
FOnMeasureItem := nil;
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
alRight:
|
alRight:
|
||||||
begin
|
begin
|
||||||
if FTabItemswidth then
|
if FTabItemswidth then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
FClientarea[2] :=rec[2]-FTabItemswidth[0];
|
FClientarea[2] :=rec[2]-FTabItemswidth[0];
|
||||||
if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then
|
if length(FTabItemswidth)>1 and (FMaxsize>(rec[3]-rec[1])) then
|
||||||
begin
|
begin
|
||||||
|
|
@ -211,9 +210,10 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
begin
|
begin
|
||||||
if FScrollBtnRect and (not FTabRects[id]) then
|
if FScrollBtnRect and (not FTabRects[id]) then
|
||||||
begin
|
begin
|
||||||
|
tl := (FTabItems.length()-1);
|
||||||
if id>FirstViewIndex then
|
if id>FirstViewIndex then
|
||||||
begin
|
begin
|
||||||
while(not FTabRects[min(id+1,(FTabItems.length()-1))]) do
|
while(not FTabRects[min(id+1,tl)]) do
|
||||||
begin
|
begin
|
||||||
FirstViewIndex++;
|
FirstViewIndex++;
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
|
|
@ -221,7 +221,7 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end else
|
end else
|
||||||
if id<FirstViewIndex then
|
if id<FirstViewIndex then
|
||||||
begin
|
begin
|
||||||
while(not FTabRects[id]) do
|
while(not FTabRects[min(max(0,id),tl)]) do
|
||||||
begin
|
begin
|
||||||
FirstViewIndex--;
|
FirstViewIndex--;
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
|
|
@ -234,9 +234,9 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
if FCurrentid= id then return ;
|
if FCurrentid= id then return ;
|
||||||
if id>=0 and id<FTabItems.length() then
|
if id>=0 and id<FTabItems.length() then
|
||||||
begin
|
begin
|
||||||
if fOnSelChanging then
|
if FCurrentid<>-1 and fOnSelChanging then
|
||||||
begin
|
begin
|
||||||
e := new tuieventbase(0,FPrevid,FCurrentid,0); //m,w,l,h
|
e := new tuieventbase(0,FCurrentid,id,0); //m,w,l,h
|
||||||
doonSelChanging(self(true),e);
|
doonSelChanging(self(true),e);
|
||||||
if e.skip then return ;
|
if e.skip then return ;
|
||||||
end
|
end
|
||||||
|
|
@ -252,11 +252,11 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
end else
|
end else
|
||||||
if FTabItems.length()=0 then
|
if FTabItems.length()=0 then
|
||||||
begin
|
begin
|
||||||
FPrevid := FCurrentid;
|
FPrevid := -1;
|
||||||
FCurrentid := -1;
|
FCurrentid := -1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function PaintTabs();
|
function PaintTabs();//»æÖÆtab
|
||||||
begin
|
begin
|
||||||
dc := Canvas;
|
dc := Canvas;
|
||||||
dc.font := font;
|
dc.font := font;
|
||||||
|
|
@ -338,15 +338,29 @@ type tcustompagecontrol = class(TCustomControl)
|
||||||
begin
|
begin
|
||||||
if FTabItems.length()=0 then
|
if FTabItems.length()=0 then
|
||||||
begin
|
begin
|
||||||
FCurrentid := -1;
|
FCurrentid := -1;
|
||||||
|
FPrevid := -1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return setselidx(id-1);
|
FCurrentid := -1;
|
||||||
|
FPrevid := -1;
|
||||||
|
cid := min(max(0,id-1),FTabItems.length()-1);
|
||||||
|
if cid >=0 then
|
||||||
|
begin
|
||||||
|
return setselidx(cid);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if FOnSelChanged then
|
||||||
|
begin
|
||||||
|
doonSelChange(self(true),new tuieventbase(0,-1,-1,0));
|
||||||
|
end
|
||||||
|
end
|
||||||
end else
|
end else
|
||||||
if id<FCurrentid then
|
if id<FCurrentid then
|
||||||
begin
|
begin
|
||||||
FCurrentid--;
|
FCurrentid--;
|
||||||
end
|
end
|
||||||
|
FPrevid := -1;
|
||||||
CalcTabs();
|
CalcTabs();
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -3120,7 +3120,7 @@ type TCustomListBoxbase=class(TCustomScrollControl)
|
||||||
@param(ItemCount)(integer) 项数量 %%
|
@param(ItemCount)(integer) 项数量 %%
|
||||||
**}
|
**}
|
||||||
protected
|
protected
|
||||||
function SetItemCount(n);override;
|
function SetItemCount(n);
|
||||||
begin
|
begin
|
||||||
if not(n >= 0)then return;
|
if not(n >= 0)then return;
|
||||||
nn := integer(n);
|
nn := integer(n);
|
||||||
|
|
@ -3148,20 +3148,59 @@ type TCustomListBoxbase=class(TCustomScrollControl)
|
||||||
return 1;
|
return 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
type tlistdrawevent = class(tuieventbase)
|
||||||
|
{**
|
||||||
|
@explan(说明)列表绘制消息对象 %%
|
||||||
|
@param(id)(integer) 序号 %%
|
||||||
|
@param(rec)(array(左上右下)) 区域 %%
|
||||||
|
@param(sel)(bool) 选择状态 %%
|
||||||
|
@param(canvas)(TCanvas) 画布 %%
|
||||||
|
**}
|
||||||
|
function create(i,s,r,c);
|
||||||
|
begin
|
||||||
|
inherited create(0,0,0,0);
|
||||||
|
idx := i;
|
||||||
|
sel := s;
|
||||||
|
rec := r;
|
||||||
|
Canvas := c;
|
||||||
|
end
|
||||||
|
rec;
|
||||||
|
idx;
|
||||||
|
sel;
|
||||||
|
canvas;
|
||||||
|
end
|
||||||
type TcustomListBox=class(TCustomListBoxbase)
|
type TcustomListBox=class(TCustomListBoxbase)
|
||||||
{**
|
{**
|
||||||
@explan(说明) listbox控件 %%
|
@explan(说明) listbox控件 %%
|
||||||
**}
|
**}
|
||||||
|
private
|
||||||
|
FListitemheigt;
|
||||||
|
protected
|
||||||
|
function GetYScrollDelta();override;
|
||||||
|
begin
|
||||||
|
if ownerdraw and FListitemheigt>0 then
|
||||||
|
begin
|
||||||
|
return FListitemheigt;
|
||||||
|
end else return inherited;
|
||||||
|
end
|
||||||
|
public
|
||||||
function Create(AOwner);override;
|
function Create(AOwner);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
FOwnerDraw := false;
|
||||||
border := true;
|
border := true;
|
||||||
FitemData := new tnumindexarray();
|
FitemData := new tnumindexarray();
|
||||||
FSelBegin :=-1;
|
FSelBegin :=-1;
|
||||||
FSelEnd :=-1;
|
FSelEnd :=-1;
|
||||||
FMultisel := false;
|
FMultisel := false;
|
||||||
fcheckbox := false;
|
fcheckbox := false;
|
||||||
|
fselbkcolor := 0xFFE7CB;
|
||||||
end
|
end
|
||||||
|
function FontChanged(o);override;
|
||||||
|
begin
|
||||||
|
if fownerdraw then return ;
|
||||||
|
return inherited;
|
||||||
|
end
|
||||||
function MouseUp(o,e);override;
|
function MouseUp(o,e);override;
|
||||||
begin
|
begin
|
||||||
if FIsMouseDown then //已经按下过
|
if FIsMouseDown then //已经按下过
|
||||||
|
|
@ -3262,9 +3301,9 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
**}
|
**}
|
||||||
r := PaintIdxBkg(idx,rc,cvs);
|
r := PaintIdxBkg(idx,rc,cvs);
|
||||||
rc1 := rc;
|
rc1 := rc;
|
||||||
|
rc1[4]:=r;
|
||||||
if fcheckbox then
|
if fcheckbox then
|
||||||
begin
|
begin
|
||||||
|
|
||||||
h := rc[3]-rc[1];
|
h := rc[3]-rc[1];
|
||||||
nh := min(h,16);
|
nh := min(h,16);
|
||||||
nnh := integer((h-nh)/2);
|
nnh := integer((h-nh)/2);
|
||||||
|
|
@ -3276,6 +3315,12 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
end
|
end
|
||||||
function PaintIdexText(idx,rc,cvs);virtual;
|
function PaintIdexText(idx,rc,cvs);virtual;
|
||||||
begin
|
begin
|
||||||
|
if fownerdraw and Fondrawlist then
|
||||||
|
begin
|
||||||
|
e := new tlistdrawevent(idx,rc[4],rc,cvs);
|
||||||
|
CallMessgeFunction(Fondrawlist,self(true),e);
|
||||||
|
return ;
|
||||||
|
end
|
||||||
cvs.DrawText(getItemText(idx),rc,DT_NOPREFIX);
|
cvs.DrawText(getItemText(idx),rc,DT_NOPREFIX);
|
||||||
end
|
end
|
||||||
function getCurrentSelection();virtual;
|
function getCurrentSelection();virtual;
|
||||||
|
|
@ -3446,10 +3491,11 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
if CheckListItems(ari)then
|
if CheckListItems(ari)then
|
||||||
begin
|
begin
|
||||||
FitemData.Pushs(ari);
|
FitemData.Pushs(ari);
|
||||||
class(TCustomListBoxbase).ItemCount := FitemData.length();
|
inherited SetItemCount(FitemData.length());
|
||||||
|
//class(TCustomListBoxbase).ItemCount := ;
|
||||||
return ItemCount-1;
|
return ItemCount-1;
|
||||||
end
|
end
|
||||||
return-1;
|
return -1;
|
||||||
end
|
end
|
||||||
function insertItem(item,n);virtual;
|
function insertItem(item,n);virtual;
|
||||||
begin
|
begin
|
||||||
|
|
@ -3535,50 +3581,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
if FSelBegin >= 0 and FSelEnd >= FSelBegin then deleteItems(const FSelBegin,FSelEnd-FSelBegin+1);
|
if FSelBegin >= 0 and FSelEnd >= FSelBegin then deleteItems(const FSelBegin,FSelEnd-FSelBegin+1);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function findStrBeginwith(str,b,n);virtual;
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@explan(说明)在列表框中指定项之后查找以字符串开头的项,到达末尾即从头开始%%
|
|
||||||
@param(str)(string)给定字符串%%
|
|
||||||
@param(b)(bool)1:不区分大小写,0:区分大小写%%
|
|
||||||
@param(n)(integer)指定项下标,默认为-1%%
|
|
||||||
@return(integer)返回找到的项的下标,未找到则返回-1%%
|
|
||||||
**}
|
|
||||||
if ifnil(b)then b := 0;
|
|
||||||
if ifnil(n)then n :=-1;
|
|
||||||
if CheckListItem(str)and ifnumber(n)then
|
|
||||||
begin
|
|
||||||
if not isValidIndex(n)then n :=-1;
|
|
||||||
if b then
|
|
||||||
begin
|
|
||||||
return findBeginwithCaseIndepent(str,n);
|
|
||||||
end else
|
|
||||||
return findBeginwith(str,n);
|
|
||||||
end
|
|
||||||
ShowErrorMessage("function findStrBeginwith:ErrorParameter(s)");
|
|
||||||
return-1;
|
|
||||||
end
|
|
||||||
function findStrExact(str,b,n);virtual;
|
|
||||||
begin
|
|
||||||
{**
|
|
||||||
@ignore(忽略) %%
|
|
||||||
@explan(说明)在列表框中指定项之后查找与字符串相同的项,到达末尾即从头开始%%
|
|
||||||
@param(str)(string)给定字符串%%
|
|
||||||
@param(b)(bool)1:不区分大小写,0:区分大小写,默认为0%%
|
|
||||||
@param(n)(integer)指定项下标,默认为-1%%
|
|
||||||
@return(integer)匹配项的索引,查找失败则返回-1%%
|
|
||||||
**}
|
|
||||||
if ifnil(b)then b := 0;
|
|
||||||
if ifnil(n)then n :=-1;
|
|
||||||
if CheckListItem(str)and ifnumber(n)then
|
|
||||||
begin
|
|
||||||
if not isValidIndex(n)then n :=-1;
|
|
||||||
if b then return findExactCaseIndepent(str,n);
|
|
||||||
else return findExact(str,n);
|
|
||||||
end
|
|
||||||
ShowErrorMessage("function findStrExact:ErrorParameter(s)");
|
|
||||||
return -1;
|
|
||||||
end
|
|
||||||
function setData(ari);virtual;
|
function setData(ari);virtual;
|
||||||
begin
|
begin
|
||||||
IncPaintLock();
|
IncPaintLock();
|
||||||
|
|
@ -3641,14 +3644,21 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
function Recycling();override;
|
function Recycling();override;
|
||||||
begin
|
begin
|
||||||
FselectionChange := nil;
|
FselectionChange := nil;
|
||||||
|
Fondrawlist := nil;
|
||||||
return inherited;
|
return inherited;
|
||||||
end
|
end
|
||||||
property ItemCount read GetItemCount;
|
property ItemHeight:integer read GetYScrollDelta write setItemHeight;
|
||||||
|
property ItemCount:integer read GetItemCount write SetItemCount;
|
||||||
property Multisel:bool read FMultisel write SetMultisel;
|
property Multisel:bool read FMultisel write SetMultisel;
|
||||||
property checkbox:bool read fcheckbox write setcheckbox;
|
property checkbox:bool read fcheckbox write setcheckbox;
|
||||||
property onSelectionChange read FselectionChange write FselectionChange;
|
property onSelectionChange read FselectionChange write FselectionChange;
|
||||||
|
property selbkcolor:color read fselbkcolor write setselbkcolor;
|
||||||
property onSelchanged:eventhandler read FselectionChange write FselectionChange;
|
property onSelchanged:eventhandler read FselectionChange write FselectionChange;
|
||||||
|
property ondrawlist:eventhandler read Fondrawlist write Fondrawlist;
|
||||||
property Items:strings read GetData write setData;
|
property Items:strings read GetData write setData;
|
||||||
|
property itemindex:tsl read getCurrentSelection write setCurrentSelection;
|
||||||
|
property ownerdraw:bool read fownerdraw write setownerdraw;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
function CheckListItems(s);
|
function CheckListItems(s);
|
||||||
begin
|
begin
|
||||||
|
|
@ -3664,7 +3674,8 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
{**
|
{**
|
||||||
@explan(说明) 项检查,重写该方法可以控制项的类型 %%
|
@explan(说明) 项检查,重写该方法可以控制项的类型 %%
|
||||||
**}
|
**}
|
||||||
return ifstring(s);
|
return true;
|
||||||
|
//return ifstring(s);
|
||||||
end
|
end
|
||||||
function isValidIndex(n);
|
function isValidIndex(n);
|
||||||
begin
|
begin
|
||||||
|
|
@ -3679,15 +3690,53 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
@explan(说明)(TMyarrayB) list数据数据,不要试图修改该变量
|
@explan(说明)(TMyarrayB) list数据数据,不要试图修改该变量
|
||||||
**}
|
**}
|
||||||
private
|
private
|
||||||
|
function setItemHeight(h);
|
||||||
|
begin
|
||||||
|
if h>0 and h<>FListitemheigt then
|
||||||
|
begin
|
||||||
|
FListitemheigt := integer(h);
|
||||||
|
if FOwnerDraw then
|
||||||
|
begin
|
||||||
|
doControlALign();
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function setselbkcolor(v);
|
||||||
|
begin
|
||||||
|
if (v>0 or v<0) and v<>fselbkcolor then
|
||||||
|
begin
|
||||||
|
fselbkcolor := v;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function SetItemCount(n);
|
||||||
|
begin
|
||||||
|
if fownerdraw and (n>=0) and ItemCount<>n then
|
||||||
|
begin
|
||||||
|
d := nils(n);
|
||||||
|
setData(d);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function setownerdraw(v);
|
||||||
|
begin
|
||||||
|
nv := v?true:false;
|
||||||
|
if FOwnerDraw<>nv then
|
||||||
|
begin
|
||||||
|
FOwnerDraw := nv;
|
||||||
|
if not(FListitemheigt>0) then
|
||||||
|
begin
|
||||||
|
FListitemheigt := font.Height+4;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
function PaintIdxBkg(idx,rc,cvs);
|
function PaintIdxBkg(idx,rc,cvs);
|
||||||
begin
|
begin
|
||||||
if(idx >= min(FSelBegin,FSelEnd)and idx <= max(FSelBegin,FSelEnd))or(FMultisel=2 and FMultisel3Data[idx])then
|
if(idx >= min(FSelBegin,FSelEnd)and idx <= max(FSelBegin,FSelEnd))or(FMultisel=2 and FMultisel3Data[idx])then
|
||||||
begin
|
begin
|
||||||
r := true;
|
r := true;
|
||||||
cvs.brush.Color := rgb(204,231,255);
|
cvs.brush.Color := fselbkcolor;//0xFFE7CB;//rgb(204,231,255);
|
||||||
end else
|
cvs.FillRect(rc);
|
||||||
cvs.Brush.Color := Color;
|
end
|
||||||
cvs.FillRect(rc);
|
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
function setcheckbox(c);
|
function setcheckbox(c);
|
||||||
|
|
@ -3716,30 +3765,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
begin
|
begin
|
||||||
return FitemData.Data;
|
return FitemData.Data;
|
||||||
end
|
end
|
||||||
function findBeginwith(str,n);
|
|
||||||
begin
|
|
||||||
len := class(TCustomListBoxbase).ItemCount;
|
|
||||||
while i++<> len do if AnsiStartsStr(str,getItem((i+n)%len))then return(i+n)%len;
|
|
||||||
return -1;
|
|
||||||
end
|
|
||||||
function findBeginwithCaseIndepent(str,n);
|
|
||||||
begin
|
|
||||||
len := class(TCustomListBoxbase).ItemCount;
|
|
||||||
while i++<> len do if AnsiStartsText(str,getItem((i+n)%len))then return(i+n)%len;
|
|
||||||
return -1;
|
|
||||||
end
|
|
||||||
function findExact(str,n);
|
|
||||||
begin
|
|
||||||
len := class(TCustomListBoxbase).ItemCount;
|
|
||||||
while i++ <> len do if getItem((i+n)%len)=str then return(i+n)%len;
|
|
||||||
return -1;
|
|
||||||
end
|
|
||||||
function findExactCaseIndepent(str,n);
|
|
||||||
begin
|
|
||||||
len := class(TCustomListBoxbase).ItemCount;
|
|
||||||
while i++ <> len do if UpperCase(getItem((i+n)%len))=UpperCase(str)then return(i+n)%len;
|
|
||||||
return -1;
|
|
||||||
end
|
|
||||||
function SelRange(sel);
|
function SelRange(sel);
|
||||||
begin
|
begin
|
||||||
if FSelBegin >= 0 and FSelEnd >= 0 then
|
if FSelBegin >= 0 and FSelEnd >= 0 then
|
||||||
|
|
@ -3826,8 +3852,12 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
end
|
end
|
||||||
if selchange then CallMessgeFunction(FselectionChange,self(true),nil);
|
if selchange then CallMessgeFunction(FselectionChange,self(true),nil);
|
||||||
end
|
end
|
||||||
|
private
|
||||||
|
fselbkcolor;
|
||||||
|
FOwnerDraw;
|
||||||
// FselectionCancel;
|
// FselectionCancel;
|
||||||
FselectionChange;
|
FselectionChange;
|
||||||
|
Fondrawlist;
|
||||||
FSelBegin;
|
FSelBegin;
|
||||||
FSelEnd;
|
FSelEnd;
|
||||||
FIsMouseDown;
|
FIsMouseDown;
|
||||||
|
|
@ -3854,7 +3884,6 @@ type TCustomComboBoxbase=class(TCustomControl)
|
||||||
FListBox := CreateAlist();
|
FListBox := CreateAlist();
|
||||||
if FListBox is class(TWinControl)then
|
if FListBox is class(TWinControl)then
|
||||||
begin
|
begin
|
||||||
//FListBox.Parent := self(true);
|
|
||||||
FListBox.OnClose := function(o,e)
|
FListBox.OnClose := function(o,e)
|
||||||
begin
|
begin
|
||||||
e.skip := true;
|
e.skip := true;
|
||||||
|
|
@ -3898,15 +3927,25 @@ type TCustomComboBoxbase=class(TCustomControl)
|
||||||
if not((FListBox is class(TWincontrol))and FListBox.WsPopUp)then return;
|
if not((FListBox is class(TWincontrol))and FListBox.WsPopUp)then return;
|
||||||
if flg and not(FListBox.Visible)then
|
if flg and not(FListBox.Visible)then
|
||||||
begin
|
begin
|
||||||
|
if Fondropdown then
|
||||||
|
begin
|
||||||
|
e := new tuieventbase(0,0,0,0);
|
||||||
|
CallMessgeFunction(Fondropdown,self(true),e);
|
||||||
|
end
|
||||||
SetListBoxRect();
|
SetListBoxRect();
|
||||||
FListBox.OnActivate := thisfunction(ListActivate);
|
FListBox.OnActivate := thisfunction(ListActivate);
|
||||||
FListBox.show(5);
|
FListBox.show(5);
|
||||||
CallMessgeFunction(ondropdown,self(true),e);
|
|
||||||
end else
|
end else
|
||||||
if not(flg) and FListBox.Visible then
|
if not(flg) and FListBox.Visible then
|
||||||
begin
|
begin
|
||||||
|
if Foncloseup then
|
||||||
|
begin
|
||||||
|
e := new tuieventbase(0,0,0,0);
|
||||||
|
CallMessgeFunction(Foncloseup,self(true),e);
|
||||||
|
end
|
||||||
FListBox.Visible := false;
|
FListBox.Visible := false;
|
||||||
CallMessgeFunction(oncloseup,self(true),e);
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Recycling();override;
|
function Recycling();override;
|
||||||
|
|
@ -3994,14 +4033,15 @@ type TCustomComboBoxbase=class(TCustomControl)
|
||||||
end
|
end
|
||||||
function getlistitemcount();virtual; //获得项目
|
function getlistitemcount();virtual; //获得项目
|
||||||
begin
|
begin
|
||||||
return FListBox.ItemCount;
|
return 0;
|
||||||
end
|
end
|
||||||
function getlistitemheight();virtual; //获得项目高
|
function getlistitemheight();virtual; //获得项目高
|
||||||
begin
|
begin
|
||||||
return FListBox.ItemHeight;
|
return 20;
|
||||||
end
|
end
|
||||||
function GetItemIndex();virtual;//获得选中的序号
|
function GetItemIndex();virtual;//获得选中的序号
|
||||||
begin
|
begin
|
||||||
|
return -1;
|
||||||
end
|
end
|
||||||
function SetItemIndex();virtual;//设置选中的序号
|
function SetItemIndex();virtual;//设置选中的序号
|
||||||
begin
|
begin
|
||||||
|
|
@ -4250,6 +4290,14 @@ type TcustomComboBox=class(TCustomComboBoxbase)
|
||||||
FEdit.Readonly := nv;
|
FEdit.Readonly := nv;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function getlistitemcount();override; //获得项目
|
||||||
|
begin
|
||||||
|
return FListBox.ItemCount;
|
||||||
|
end
|
||||||
|
function getlistitemheight();override; //获得项目高
|
||||||
|
begin
|
||||||
|
return FListBox.ItemHeight;
|
||||||
|
end
|
||||||
function GetItemIndex();override;
|
function GetItemIndex();override;
|
||||||
begin
|
begin
|
||||||
//if FMultisel and (csDesigning in ComponentState) then return -1;
|
//if FMultisel and (csDesigning in ComponentState) then return -1;
|
||||||
|
|
@ -4602,8 +4650,7 @@ type TcustomToolBar=class(TCustomControl)
|
||||||
**}
|
**}
|
||||||
function Create(AOwner);override;
|
function Create(AOwner);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
|
||||||
end
|
end
|
||||||
function AfterConstruction();override;
|
function AfterConstruction();override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -4620,6 +4667,11 @@ type TcustomToolBar=class(TCustomControl)
|
||||||
FTimer.Interval := 200;
|
FTimer.Interval := 200;
|
||||||
FTimer.Ontimer := thisfunction(DoTimerShowTip);
|
FTimer.Ontimer := thisfunction(DoTimerShowTip);
|
||||||
end
|
end
|
||||||
|
function FontChanged(o);override;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if fmainmenu then doControlALign();
|
||||||
|
end
|
||||||
function MouseDown(o,e);override;
|
function MouseDown(o,e);override;
|
||||||
begin
|
begin
|
||||||
if csDesigning in ComponentState then return;
|
if csDesigning in ComponentState then return;
|
||||||
|
|
@ -4867,21 +4919,29 @@ type TcustomToolBar=class(TCustomControl)
|
||||||
begin
|
begin
|
||||||
if fmainmenu then
|
if fmainmenu then
|
||||||
begin
|
begin
|
||||||
c.brush.Color := 0xe0e0e0;
|
c.brush.Color := 0xffffbb;
|
||||||
c.FillRect(ci);
|
c.FillRect(ci);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONCHECK);
|
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONCHECK);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if bi.enabled then
|
if fmainmenu then
|
||||||
begin
|
begin
|
||||||
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH);
|
c.brush.Color := Color;////;
|
||||||
end else
|
|
||||||
begin
|
|
||||||
c.brush.Color := 0x8c8c8c;////0xc0c0cc;
|
|
||||||
c.FillRect(ci);
|
c.FillRect(ci);
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if bi.enabled then
|
||||||
|
begin
|
||||||
|
c.draw("framecontrol",array(ci[0:1],ci[2:3]),DFC_BUTTON,DFCS_BUTTONPUSH);
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
c.brush.Color := 0x8c8c8c;////0xc0c0cc;
|
||||||
|
c.FillRect(ci);
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if fmainmenu then
|
if fmainmenu then
|
||||||
begin
|
begin
|
||||||
|
|
@ -5072,11 +5132,7 @@ type TcustomToolBar=class(TCustomControl)
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function FontChanged(o);override;
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
if fmainmenu then doControlALign();
|
|
||||||
end
|
|
||||||
private
|
private
|
||||||
function mainmenuchanged();
|
function mainmenuchanged();
|
||||||
begin
|
begin
|
||||||
|
|
@ -5132,8 +5188,9 @@ type TcustomToolBar=class(TCustomControl)
|
||||||
begin
|
begin
|
||||||
s := mu.Caption;
|
s := mu.Caption;
|
||||||
wh := GetTextWidthAndHeightWidthFont(s,self.font,0);// wh
|
wh := GetTextWidthAndHeightWidthFont(s,self.font,0);// wh
|
||||||
fmenubtnrects[i]:= array(x,y,x+wh[0]+5,rc[3]);
|
nwh := x+wh[0]+15;
|
||||||
x:=x+wh[0]+15;
|
fmenubtnrects[i]:= array(x,y,nwh,rc[3]);
|
||||||
|
x:=nwh;
|
||||||
if x>rc[2] then break; //只有一行
|
if x>rc[2] then break; //只有一行
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -1801,7 +1801,7 @@ type TcustomTreeCtl = class(TVirtualList)
|
||||||
begin
|
begin
|
||||||
it.UnExpand();
|
it.UnExpand();
|
||||||
end else
|
end else
|
||||||
CallMessgeFunction(ondblclick,o,e);
|
CallMessgeFunction(ondblclick,o,e);
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function MouseUp(o,e);override;
|
function MouseUp(o,e);override;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue