设计器

修正bug
This commit is contained in:
JianjunLiu 2022-09-26 09:59:29 +08:00
parent 831166df5f
commit c33057b131
3 changed files with 77 additions and 74 deletions

View File

@ -246,9 +246,9 @@ type TVclDesigner = class(tvcform)
tc := data[0]; tc := data[0];
if (tc is class(TDRootComponent)) and not( tc is class(TDMenu)) then if (tc is class(TDRootComponent)) and not( tc is class(TDMenu)) then
begin begin
nd := (FTree.RootItem.items)[0]; tr := nd.owner;
nd := (tr.RootItem.items)[0];
end end
nnd := tc.ComponentCreater(nd,nd.Component.Cwnd); nnd := tc.ComponentCreater(nd,nd.Component.Cwnd);
if not nnd then return 1; //加入失败处理 if not nnd then return 1; //加入失败处理
nnd.CreateName(); nnd.CreateName();
@ -656,7 +656,7 @@ type TVclDesigner = class(tvcform)
t := n.Component; t := n.Component;
if not t then exit; if not t then exit;
mu := t.CreateMenu(); mu := t.CreateMenu();
FTree.PopupMenu := mu; n.owner.PopupMenu := mu;
FPropGrid.Component := t; FPropGrid.Component := t;
FEventGrid.Component := t; FEventGrid.Component := t;
wd := t.cwnd ; wd := t.cwnd ;
@ -672,7 +672,7 @@ type TVclDesigner = class(tvcform)
nd := o._tag; nd := o._tag;
if FCurrentNode<>nd then if FCurrentNode<>nd then
begin begin
FTree.SetSel(nd); nd.owner.SetSel(nd);
TreeNodeSelected(nd); TreeNodeSelected(nd);
end end
cp := nd.Component; cp := nd.Component;
@ -757,11 +757,12 @@ type TVclDesigner = class(tvcform)
@explan(说明) 组件被点击 %% @explan(说明) 组件被点击 %%
**} **}
nd := o._tag; nd := o._tag;
tr := nd.owner;
if FCurrentNode<> nd then if FCurrentNode<> 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);
FTree.SetSel(nd); tr.SetSel(nd);
TreeNodeSelected(nd); TreeNodeSelected(nd);
end; end;
setcomponentfocus(o,true); setcomponentfocus(o,true);
@ -770,7 +771,7 @@ type TVclDesigner = class(tvcform)
//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 := (FTree.RootItem.items)[0]; FCurrentNode := (tr.RootItem.items)[0];
if not FCurrentNode then exit; if not FCurrentNode then exit;
O1 := FCurrentNode.Component.Cwnd; O1 := FCurrentNode.Component.Cwnd;
if not o1 then exit; if not o1 then exit;
@ -819,12 +820,6 @@ type TVclDesigner = class(tvcform)
cct := o._tag; cct := o._tag;
//if FComponentCreater=cct then exit; //if FComponentCreater=cct then exit;
FComponentCreater := cct; FComponentCreater := cct;
return ;
fm := (FTree.RootItem.items)[0];
if not fm then exit;
O1 := fm.Component.Cwnd;
o1.show();
end end
function CloseShowForm(); //主窗口关闭 function CloseShowForm(); //主窗口关闭

View File

@ -854,7 +854,12 @@ type TDForm = class(TDComponent)
private private
static FClassName; static FClassName;
static FParser; static FParser;
function savecurrentform(o,e); function closecurrentform(o,e); //关闭当前窗口
begin
cp := o.Component;
cp.Cwnd._send_(o.WM_CLOSE,0,0,1);
end
function savecurrentform(o,e);//保存当前窗口
begin begin
cp:=o.Component; cp:=o.Component;
if not cp then exit; if not cp then exit;
@ -863,7 +868,6 @@ type TDForm = class(TDComponent)
if d then if d then
begin begin
d.saveCurrentForm(); d.saveCurrentForm();
//d.openclassfile();
end end
end end
function OpenClass(o,e); function OpenClass(o,e);
@ -882,9 +886,11 @@ type TDForm = class(TDComponent)
begin begin
r := array(); r := array();
//r[0] := array("type":"menu","caption":"保存窗口"); //r[0] := array("type":"menu","caption":"保存窗口");
r[0] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass)); idx := 0;
r[1] := array("type":"menu","caption":"保存当前窗口","onclick":thisfunction(savecurrentform)); r[idx++] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass));
r[2] := array("type":"menu","caption":"粘贴","onclick":thisfunction(pasteclick)); r[idx++] := array("type":"menu","caption":"关闭窗口","onclick":thisfunction(closecurrentform));
r[idx++] := array("type":"menu","caption":"保存窗口","onclick":thisfunction(savecurrentform));
r[idx++] := array("type":"menu","caption":"粘贴","onclick":thisfunction(pasteclick));
//r[2] := array("type":"menu","caption":"打开工程目录","onclick":thisfunction(openProjectDir)); //r[2] := array("type":"menu","caption":"打开工程目录","onclick":thisfunction(openProjectDir));
return r; return r;
end end
@ -958,6 +964,63 @@ type TDPanelForm = class(TDForm)
inherited; inherited;
end end
end end
type TDMenu = class(TDMenuBase)
{**
@explan(说明) 普通菜单设计器控件 %%
**}
function HitTip();override;
begin
return inherited;
return "menu通过右键添加";
end
function classification();override;
begin
return "非点击添加控件" ;
end
function InToolBar();override;
begin
return false;
end
function WndClass();override;
begin
return class(tmenu);
end
function Create(AOwner);override;
begin
inherited;
end
function CheckParent(p,pwnd);override;
begin
r := (p is class(TDMenu)) or
(p is class(TDMainMenu)) or
(p is class(TDPopUpMenu));
Pwnd := p.GetTrueComponent;
return r;
end
private
function ifmainmenunode(pwnd);
begin
if pwnd is class(tmainmenu) then return true;
if pwnd is class(tmenu) then
begin
return ifmainmenunode(pwnd.parent);
end
return false;
end
public
function SetViewParent(wnd,pwnd);override;
begin
if ifmainmenunode(pwnd) then wnd.parent := pwnd;
end
function ComponentCreater(node,owner);override;
begin
r := inherited;
node.owner.expand(node);
return r;
end
end
implementation implementation
type TComponentMenu= class(tmenu) //设计器右键菜单 type TComponentMenu= class(tmenu) //设计器右键菜单
@ -1935,63 +1998,7 @@ type TDMainMenu = class(TDMenuBase)
end end
type TDMenu = class(TDMenuBase)
{**
@explan(说明) 普通菜单设计器控件 %%
**}
function HitTip();override;
begin
return inherited;
return "menu通过右键添加";
end
function classification();override;
begin
return "非点击添加控件" ;
end
function InToolBar();override;
begin
return false;
end
function WndClass();override;
begin
return class(tmenu);
end
function Create(AOwner);override;
begin
inherited;
end
function CheckParent(p,pwnd);override;
begin
r := (p is class(TDMenu)) or
(p is class(TDMainMenu)) or
(p is class(TDPopUpMenu));
Pwnd := p.GetTrueComponent;
return r;
end
private
function ifmainmenunode(pwnd);
begin
if pwnd is class(tmainmenu) then return true;
if pwnd is class(tmenu) then
begin
return ifmainmenunode(pwnd.parent);
end
return false;
end
public
function SetViewParent(wnd,pwnd);override;
begin
if ifmainmenunode(pwnd) then wnd.parent := pwnd;
end
function ComponentCreater(node,owner);override;
begin
r := inherited;
node.owner.expand(node);
return r;
end
end
type TDAction = class(TDComponent) type TDAction = class(TDComponent)
{** {**
@explan(说明) action设计器控件 %% @explan(说明) action设计器控件 %%

View File

@ -723,6 +723,7 @@ type TTslDebuga=class(TCustomControl)
if n then if n then
begin begin
//echo "\r\n====add:",usr,"====",n,"===",idx; //echo "\r\n====add:",usr,"====",n,"===",idx;
//echo "\r\n>>",(idx+1)," ",item.ScriptPath;
dbgsetbreak(FConnectchannel,usr,n,idx+1); dbgsetbreak(FConnectchannel,usr,n,idx+1);
end end
end end