parent
b26de5f0fc
commit
80977eb23d
|
|
@ -2237,7 +2237,7 @@ type TListBox = class(TcustomListBox)
|
||||||
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","items",
|
||||||
"multisel","popupmenu","wsdlgmodalframe",
|
"multisel","checkbox","popupmenu","wsdlgmodalframe",
|
||||||
"onmousedown","onmouseup",
|
"onmousedown","onmouseup",
|
||||||
"onselectionchange"
|
"onselectionchange"
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3134,6 +3134,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
FSelBegin :=-1;
|
FSelBegin :=-1;
|
||||||
FSelEnd :=-1;
|
FSelEnd :=-1;
|
||||||
FMultisel := false;
|
FMultisel := false;
|
||||||
|
fcheckbox := false;
|
||||||
end
|
end
|
||||||
function MouseUp(o,e);override;
|
function MouseUp(o,e);override;
|
||||||
begin
|
begin
|
||||||
|
|
@ -3233,8 +3234,19 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
@param(rc)(array) »æÖÆÇøÓò%%
|
@param(rc)(array) »æÖÆÇøÓò%%
|
||||||
@param(cvs)(tcustomcanvas) »²¼ %%
|
@param(cvs)(tcustomcanvas) »²¼ %%
|
||||||
**}
|
**}
|
||||||
PaintIdxBkg(idx,rc,cvs);
|
r := PaintIdxBkg(idx,rc,cvs);
|
||||||
PaintIdexText(idx,rc,cvs);
|
rc1 := rc;
|
||||||
|
if fcheckbox then
|
||||||
|
begin
|
||||||
|
|
||||||
|
h := rc[3]-rc[1];
|
||||||
|
nh := min(h,16);
|
||||||
|
nnh := integer((h-nh)/2);
|
||||||
|
rc2 := array(rc[0]+2,rc[1]+nnh,rc[0]+nh+2,rc[3]-nnh);
|
||||||
|
cvs.Draw("framecontrol",array(rc2[0:1],rc2[2:3]),DFC_BUTTON,(r)?DFCS_CHECKED:DFCS_BUTTONCHECK);
|
||||||
|
rc1[0]+=nh+5;
|
||||||
|
end
|
||||||
|
PaintIdexText(idx,rc1,cvs);
|
||||||
end
|
end
|
||||||
function PaintIdexText(idx,rc,cvs);virtual;
|
function PaintIdexText(idx,rc,cvs);virtual;
|
||||||
begin
|
begin
|
||||||
|
|
@ -3264,7 +3276,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
FSelBegin := FSelEnd := n;
|
FSelBegin := FSelEnd := n;
|
||||||
InvalidateRect(nil,false);
|
InvalidateRect(nil,false);
|
||||||
end else
|
end else
|
||||||
if ifarray(n)and isValidIndex(n[1])and isValidIndex(n[0])then
|
if ifarray(n) and isValidIndex(n[1])and isValidIndex(n[0])then
|
||||||
begin
|
begin
|
||||||
FSelBegin := MinValue(n);
|
FSelBegin := MinValue(n);
|
||||||
FSelEnd := MaxValue(n);
|
FSelEnd := MaxValue(n);
|
||||||
|
|
@ -3331,9 +3343,12 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
@param(state)(bool)״̬%%
|
@param(state)(bool)״̬%%
|
||||||
**}
|
**}
|
||||||
b := state?1:0;
|
b := state?1:0;
|
||||||
if FMultisel <> 2 or not isValidIndex(n)or b=getItemSelectedState(n)then return;
|
if (FMultisel <> 2) or not(isValidIndex(n)) or (b=getItemSelectedState(n)) then return;
|
||||||
if b then FMultisel3Data[n]:= b;
|
if b then FMultisel3Data[n]:= b;
|
||||||
else reindex(FMultisel3Data,array(n:nil));
|
else
|
||||||
|
begin
|
||||||
|
reindex(FMultisel3Data,array(n:nil));
|
||||||
|
end
|
||||||
if FselectionChange then
|
if FselectionChange then
|
||||||
CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0));
|
CallMessgeFunction(FselectionChange,self(true),new tuieventbase(0,0,0,0));
|
||||||
InvalidateIdxRect(n);
|
InvalidateIdxRect(n);
|
||||||
|
|
@ -3562,6 +3577,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
end
|
end
|
||||||
property ItemCount read GetItemCount;
|
property ItemCount read GetItemCount;
|
||||||
property Multisel:bool read FMultisel write SetMultisel;
|
property Multisel:bool read FMultisel write SetMultisel;
|
||||||
|
property checkbox:bool read fcheckbox write setcheckbox;
|
||||||
property onSelectionChange:eventhandler read FselectionChange write FselectionChange;
|
property onSelectionChange:eventhandler read FselectionChange write FselectionChange;
|
||||||
property Items:strings read GetData write setData;
|
property Items:strings read GetData write setData;
|
||||||
protected
|
protected
|
||||||
|
|
@ -3598,10 +3614,21 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
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;
|
||||||
cvs.brush.Color := rgb(204,231,255);
|
cvs.brush.Color := rgb(204,231,255);
|
||||||
end else
|
end else
|
||||||
cvs.Brush.Color := Color;
|
cvs.Brush.Color := Color;
|
||||||
cvs.FillRect(rc);
|
cvs.FillRect(rc);
|
||||||
|
return r;
|
||||||
|
end
|
||||||
|
function setcheckbox(c);
|
||||||
|
begin
|
||||||
|
nc := c?true:false;
|
||||||
|
if nc<>fcheckbox then
|
||||||
|
begin
|
||||||
|
fcheckbox := nc;
|
||||||
|
InvalidateRect(nil,false);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
function SetMultisel(n);
|
function SetMultisel(n);
|
||||||
begin
|
begin
|
||||||
|
|
@ -3736,6 +3763,7 @@ type TcustomListBox=class(TCustomListBoxbase)
|
||||||
FSelEnd;
|
FSelEnd;
|
||||||
FIsMouseDown;
|
FIsMouseDown;
|
||||||
FMultisel;
|
FMultisel;
|
||||||
|
fcheckbox;
|
||||||
FMultisel3Data;
|
FMultisel3Data;
|
||||||
FFormerSelBegin;
|
FFormerSelBegin;
|
||||||
FFormerSelEnd;
|
FFormerSelEnd;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue