界面库

加入onnotify消息
This commit is contained in:
JianjunLiu
2022-10-28 15:38:51 +08:00
parent e9d9e0d2e9
commit 0262217ded
11 changed files with 325 additions and 49 deletions
+189 -9
View File
@@ -3,7 +3,7 @@ interface
{**
@explan(说明) 设计器属性编辑库,继承该库,定义属性编辑类 %%
**}
uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents;
uses utslvclauxiliary,utslvclbase,utslvclgdi,uvcpropertytypespersistence,tslvcl,utslvcldcomponents,UTslSynMemo;
function registereditpropertytodesigner(cls);
type TGCellRender = class(TSLUIBASE) //属性编辑器单元格对象基类
{**
@@ -1464,15 +1464,8 @@ type TGridList = class(TListView)
end
end
//**********属性编辑类***************
/////////////////////////////////////////////////////////////////////////
type TGridCellNaturalEdit = class(TGridPropertyRender,TPropertyNatural)
@@ -3478,6 +3471,7 @@ type TtextEditor = class(tpanel)
property ItemStr read GetItemStr write SetItemStr;
end
type TGridCellTextEdit = class(TGridCellEditWithButton,TPropertyText)
{**
@explan(说明)编辑字符串文本属性%%
@@ -3590,6 +3584,188 @@ type TGridCellStringsEdit = class(TGridCellTextEdit)
inherited;
end
end
type TGridCelltslEdit = class(TGridCellEditWithButton,tpropertytsl)
{**
@explan(说明)编辑字符串文本属性%%
**}
private
isShow;
FRbuttonWidth;
screenbottom;
protected
Fowner;
Fpanel;
rowNum;
colNum;
Fgrid;
public
function create(AOwner);override;
begin
inherited;
Fowner := AOwner;
Fpanel := nil;
FRbuttonWidth := 20;
screenArr := _wapi.getscreenrect();
screenbottom := screenArr[3];
isShow := true;
end
function createEditObj();virtual;
begin
Fpanel := new ttslediter(Fowner);
end
function ButtonClick(grid,e,d);override;
begin
{**
@explan(说明) 格子点击 %%
**}
inherited;
rowNum := e.iitem;
colNum := e.isubitem;
Fgrid := grid;
pt := e.ptaction;
rec := grid.getSubItemRect(rowNum,colNum);
if pt[0]>=(rec[2]-FRbuttonWidth) then
begin
if ifnil(Fpanel) then begin
createEditObj();
Fpanel.parent := Fowner;
Fpanel.OnActivate := function(o,e)
begin
if e.lowparam = WA_INACTIVE then
begin
CellLeave(Fgrid);
end
end;
end
clickToText(d);
if Fpanel.showmodal()=1 then
begin
textChange1(Fpanel.itemData);
end
end
end
function clickToText(d);virtual;
begin
Fpanel.ItemStr := tostn(d["value"]);
end
function CellName();virtual;
begin
return "tsl";
end
function textChange1(data);virtual;
begin
Fgrid.CellChanged(rowNum,colNum,"value",data);
end
function CellDrawLabel(dc,rect,d);override;
begin
{**
@explan(说明) 绘制格子 %%
**}
dc.drawtext(cellName(),rect,DT_VCENTER.|DT_LEFT .|DT_SINGLELINE);
end
end
type TGridCelllazytslEdit = class(TGridCellEditWithButton,tpropertylazytsl)
{**
@explan(说明)编辑字符串文本属性%%
**}
private
isShow;
FRbuttonWidth;
screenbottom;
protected
Fowner;
Fpanel;
rowNum;
colNum;
Fgrid;
public
function create(AOwner);override;
begin
inherited;
Fowner := AOwner;
Fpanel := nil;
FRbuttonWidth := 20;
screenArr := _wapi.getscreenrect();
screenbottom := screenArr[3];
isShow := true;
end
function createEditObj();virtual;
begin
Fpanel := new ttslediter(Fowner);
end
function ButtonClick(grid,e,d);override;
begin
{**
@explan(说明) 格子点击 %%
**}
inherited;
rowNum := e.iitem;
colNum := e.isubitem;
Fgrid := grid;
pt := e.ptaction;
rec := grid.getSubItemRect(rowNum,colNum);
if pt[0]>=(rec[2]-FRbuttonWidth) then
begin
if ifnil(Fpanel) then begin
createEditObj();
Fpanel.parent := Fowner;
Fpanel.OnActivate := function(o,e)
begin
if e.lowparam = WA_INACTIVE then
begin
CellLeave(Fgrid);
end
end;
end
clickToText(d);
if Fpanel.showmodal()=1 then
begin
textChange1(Fpanel.itemData);
end
end
end
function clickToText(d);virtual;
begin
Fpanel.ItemStr := tostn(d["value"]);
end
function CellName();virtual;
begin
return "lazytsl";
end
function textChange1(data);virtual;
begin
Fgrid.CellChanged(rowNum,colNum,"value",data);
end
function CellDrawLabel(dc,rect,d);override;
begin
{**
@explan(说明) 绘制格子 %%
**}
dc.drawtext(cellName(),rect,DT_VCENTER.|DT_LEFT .|DT_SINGLELINE);
end
end
type ttslediter = class(TtextEditor)
function create(AOwner);
begin
inherited;
caption := "tsl";
hg := new TTslSynHighLighter(self);
memo.Highlighter := hg;
end
protected
function comfirmEdit(o,e);override;
begin
itemData := nil;
s := memo.text;
try
itemData := eval(&s);
except
end
EndModalCode := 1;
return EndModal();
end
end
type TstringsEditor = class(TtextEditor)
{**
@explan(说明)memo编辑器%%
@@ -4309,7 +4485,11 @@ begin
class(TGridCellPairIntEdit),
class(TGridCellPairSpliterTypeEdit),
class(tGridCellAlignPosBoxEdit),
class(TGridCellTreeViewDataEdit)
class(TGridCellTreeViewDataEdit),
class(TGridCelltslEdit),
class(TGridCelllazytslEdit)
));
registerproperties(psi);
end