设计器

优化
This commit is contained in:
JianjunLiu 2023-01-19 17:29:53 +08:00
parent 33d710b201
commit c7fd3cf136
3 changed files with 32 additions and 25 deletions

View File

@ -33,7 +33,7 @@ type TVclDesigner = class(tvcform)
FEventGrid; //控件事件grid FEventGrid; //控件事件grid
//************************************ //************************************
FCurrentNode; fselctlnode;
FCurrentClikPos; FCurrentClikPos;
FComponentCreater; FComponentCreater;
FRounMenu; FRounMenu;
@ -654,10 +654,10 @@ type TVclDesigner = class(tvcform)
@explan(说明) 构造组件 %% @explan(说明) 构造组件 %%
@return (TDComponent) @return (TDComponent)
**} **}
if FComponentCreater and FCurrentNode and FCurrentClikPos then if FComponentCreater and fselctlnode and FCurrentClikPos then
begin begin
par := FCurrentNode.Component.Cwnd; par := fselctlnode.Component.Cwnd;
r := FComponentCreater.ComponentCreater(FCurrentNode,par); r := FComponentCreater.ComponentCreater(fselctlnode,par);
if not r then exit; if not r then exit;
////////////////////////////////////////// //////////////////////////////////////////
//npar := par; //npar := par;
@ -692,7 +692,7 @@ type TVclDesigner = class(tvcform)
end end
FCurrentClikPos := nil; FCurrentClikPos := nil;
FComponentCreater := nil; FComponentCreater := nil;
FCurrentNode := nil; fselctlnode := nil;
FTree.PopupMenu := nil; FTree.PopupMenu := nil;
//echo "\r\n 添加控件"; //echo "\r\n 添加控件";
g_script_can_set_not_focus := false; g_script_can_set_not_focus := false;
@ -713,8 +713,8 @@ type TVclDesigner = class(tvcform)
@explan(说明) 节点被选择 %% @explan(说明) 节点被选择 %%
@param(n)(TComponentTreeNode) 被选择节点 %% @param(n)(TComponentTreeNode) 被选择节点 %%
**} **}
if FCurrentNode=n then exit; if fselctlnode=n then exit;
FCurrentNode := n; fselctlnode := n;
if not ifobj(n) then exit; if not ifobj(n) then exit;
t := n.Component; t := n.Component;
if not t then exit; if not t then exit;
@ -740,7 +740,7 @@ type TVclDesigner = class(tvcform)
FProjectManager.setnodesel(wnd); FProjectManager.setnodesel(wnd);
return ;// return ;//
end end
if FCurrentNode<>nd then if fselctlnode<>nd then
begin begin
nd.owner.SetSel(nd); nd.owner.SetSel(nd);
TreeNodeSelected(nd); TreeNodeSelected(nd);
@ -828,9 +828,9 @@ type TVclDesigner = class(tvcform)
if e.wparam then if e.wparam then
begin begin
o1 := o; o1 := o;
if FCurrentNode then if fselctlnode then
begin begin
wd := FCurrentNode.Component.Cwnd; wd := fselctlnode.Component.Cwnd;
wd1 := wd; wd1 := wd;
while wd1 do while wd1 do
begin begin
@ -862,7 +862,7 @@ type TVclDesigner = class(tvcform)
FProjectManager.setnodesel(wnd); FProjectManager.setnodesel(wnd);
return ;// return ;//
end end
if FCurrentNode<> nd then if fselctlnode<> nd then
begin begin
//wd := o;//nd.Component.Cwnd; //wd := o;//nd.Component.Cwnd;
//if wd is class(TWincontrol) then _wapi.BringWindowToTop(wd.Handle); //if wd is class(TWincontrol) then _wapi.BringWindowToTop(wd.Handle);
@ -871,14 +871,14 @@ type TVclDesigner = class(tvcform)
end; end;
setcomponentfocus(o,true); setcomponentfocus(o,true);
if factivatedonging then return ; if factivatedonging then return ;
if FComponentCreater and FCurrentNode then if FComponentCreater and fselctlnode then
begin begin
//SetSysParam("cpos_screan",array(e.lolparam,e.hilparam)); //SetSysParam("cpos_screan",array(e.lolparam,e.hilparam));
if FComponentCreater is class(TDRootComponent) then if FComponentCreater is class(TDRootComponent) then
begin begin
FCurrentNode := (tr.RootItem.items)[0]; fselctlnode := (tr.RootItem.items)[0];
if not FCurrentNode then return FComponentCreater := nil; if not fselctlnode then return FComponentCreater := nil;
//O1 := FCurrentNode.Component.Cwnd; //O1 := fselctlnode.Component.Cwnd;
//if not o1 then return FComponentCreater := nil; //if not o1 then return FComponentCreater := nil;
end end
//else o1 := o; //else o1 := o;
@ -930,7 +930,6 @@ type TVclDesigner = class(tvcform)
@explan(说明) 选择工具按钮 %% @explan(说明) 选择工具按钮 %%
**} **}
cct := o._tag; cct := o._tag;
//if FComponentCreater=cct then exit;
FComponentCreater := cct; FComponentCreater := cct;
end end
@ -938,8 +937,7 @@ type TVclDesigner = class(tvcform)
begin begin
{** {**
@explan(说明)关闭当前工程窗口%% @explan(说明)关闭当前工程窗口%%
**} **}
FProjectManager.CloseCurrentEdit(nil,true); FProjectManager.CloseCurrentEdit(nil,true);
end end
public //设计器中绑定事件 public //设计器中绑定事件
@ -994,7 +992,7 @@ type TVclDesigner = class(tvcform)
private //不同窗口切换 private //不同窗口切换
function hidenatree(nd);//隐藏控件树 function hidenatree(nd);//隐藏控件树
begin begin
FCurrentNode := nil; fselctlnode := nil;
if nd then if nd then
begin begin
tr := nd.ftree; tr := nd.ftree;
@ -1010,7 +1008,7 @@ type TVclDesigner = class(tvcform)
end end
function showtree(nd); //显示控件树 function showtree(nd); //显示控件树
begin begin
FCurrentNode := nil; fselctlnode := nil;
tr := nd.ftree; tr := nd.ftree;
tr.visible := false; tr.visible := false;
FTree.visible := true; FTree.visible := true;
@ -1043,7 +1041,7 @@ type TVclDesigner = class(tvcform)
end end
function switchtree(nd); //切换控件树 function switchtree(nd); //切换控件树
begin begin
FCurrentNode := nil; fselctlnode := nil;
if nd<>fcwindowinfo then if nd<>fcwindowinfo then
begin begin
if fcwindowinfo then //处理就有的 if fcwindowinfo then //处理就有的

View File

@ -205,6 +205,7 @@ type TGridCellEditWithButton = class(TGridPropertyRender) //
{** {**
@explan(说明)标签被点击 %% @explan(说明)标签被点击 %%
**} **}
ButtonClick(grid,e,d);
end end
function CellLeave(grid);override; //离开 function CellLeave(grid);override; //离开
begin begin
@ -331,6 +332,10 @@ type TGridCellEventHandleEdit = class(TGridCellEditList,TPropertyTypeEvent)
function create(owner);override; function create(owner);override;
begin begin
inherited; inherited;
end
function LabelClick(grid,e,d);override;
begin
end end
function CelldbClick(grid,e,d);virtual; function CelldbClick(grid,e,d);virtual;
begin begin
@ -345,8 +350,6 @@ type TGridCellEventHandleEdit = class(TGridCellEditList,TPropertyTypeEvent)
end end
type TGridCellVariableEdit = class(TGridCellEditList,TPropertyVarible) type TGridCellVariableEdit = class(TGridCellEditList,TPropertyVarible)
public public
function create(owner);override; function create(owner);override;
begin begin
inherited; inherited;

View File

@ -1922,23 +1922,28 @@ type TWinControl = class(tcontrol)
sel := -1; sel := -1;
selr := 0; selr := 0;
len := ctls.count-1 ; len := ctls.count-1 ;
ct := 0;
for i:= 0 to len do for i:= 0 to len do
begin begin
vi := ctls[i]; vi := ctls[i];
if vi is class(TWinControl) then if vi is class(TWinControl) then
begin begin
if vi.Visible then rcs[i] := vi.BoundsRect; if vi.WsPopUp then continue;
if not(vi.Visible) then continue;
rcs[i] := vi.BoundsRect;
if vi.DesigningSelect() then if vi.DesigningSelect() then
begin begin
sel := i; sel := i;
selr := rcs[i]; selr := rcs[i];
end end
ct++;
end end
end end
if sel >=0 then if (sel >=0) and (ct>1) then
begin begin
pc := cv.pen.color; pc := cv.pen.color;
pct := cv.pen.style; pct := cv.pen.style;
pcw := cv.pen.width;
cv.pen.Style := PS_DOT; cv.pen.Style := PS_DOT;
cv.pen.color := 0x3f3f3f; cv.pen.color := 0x3f3f3f;
for i := 0 to len do for i := 0 to len do
@ -1969,6 +1974,7 @@ type TWinControl = class(tcontrol)
end end
cv.pen.color := pc; cv.pen.color := pc;
cv.pen.style := pct; cv.pen.style := pct;
cv.pen.width := pcw;
end end
end end
end end