diff --git a/designer/tslvcldesigner.tsf b/designer/tslvcldesigner.tsf index 47bb440..0324aa1 100644 --- a/designer/tslvcldesigner.tsf +++ b/designer/tslvcldesigner.tsf @@ -246,9 +246,9 @@ type TVclDesigner = class(tvcform) tc := data[0]; if (tc is class(TDRootComponent)) and not( tc is class(TDMenu)) then begin - nd := (FTree.RootItem.items)[0]; + tr := nd.owner; + nd := (tr.RootItem.items)[0]; end - nnd := tc.ComponentCreater(nd,nd.Component.Cwnd); if not nnd then return 1; //加入失败处理 nnd.CreateName(); @@ -656,7 +656,7 @@ type TVclDesigner = class(tvcform) t := n.Component; if not t then exit; mu := t.CreateMenu(); - FTree.PopupMenu := mu; + n.owner.PopupMenu := mu; FPropGrid.Component := t; FEventGrid.Component := t; wd := t.cwnd ; @@ -672,7 +672,7 @@ type TVclDesigner = class(tvcform) nd := o._tag; if FCurrentNode<>nd then begin - FTree.SetSel(nd); + nd.owner.SetSel(nd); TreeNodeSelected(nd); end cp := nd.Component; @@ -757,11 +757,12 @@ type TVclDesigner = class(tvcform) @explan(说明) 组件被点击 %% **} nd := o._tag; + tr := nd.owner; if FCurrentNode<> nd then begin wd := o;//nd.Component.Cwnd; //if wd is class(TWincontrol) then _wapi.BringWindowToTop(wd.Handle); - FTree.SetSel(nd); + tr.SetSel(nd); TreeNodeSelected(nd); end; setcomponentfocus(o,true); @@ -770,7 +771,7 @@ type TVclDesigner = class(tvcform) //SetSysParam("cpos_screan",array(e.lolparam,e.hilparam)); if FComponentCreater is class(TDRootComponent) then begin - FCurrentNode := (FTree.RootItem.items)[0]; + FCurrentNode := (tr.RootItem.items)[0]; if not FCurrentNode then exit; O1 := FCurrentNode.Component.Cwnd; if not o1 then exit; @@ -818,13 +819,7 @@ type TVclDesigner = class(tvcform) **} cct := o._tag; //if FComponentCreater=cct then exit; - FComponentCreater := cct; - return ; - fm := (FTree.RootItem.items)[0]; - if not fm then exit; - O1 := fm.Component.Cwnd; - o1.show(); - + FComponentCreater := cct; end function CloseShowForm(); //主窗口关闭 diff --git a/designer/utslvcldcomponents.tsf b/designer/utslvcldcomponents.tsf index 4368a22..e4318b8 100644 --- a/designer/utslvcldcomponents.tsf +++ b/designer/utslvcldcomponents.tsf @@ -854,7 +854,12 @@ type TDForm = class(TDComponent) private static FClassName; 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 cp:=o.Component; if not cp then exit; @@ -863,7 +868,6 @@ type TDForm = class(TDComponent) if d then begin d.saveCurrentForm(); - //d.openclassfile(); end end function OpenClass(o,e); @@ -882,9 +886,11 @@ type TDForm = class(TDComponent) begin r := array(); //r[0] := array("type":"menu","caption":"保存窗口"); - r[0] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass)); - r[1] := array("type":"menu","caption":"保存当前窗口","onclick":thisfunction(savecurrentform)); - r[2] := array("type":"menu","caption":"粘贴","onclick":thisfunction(pasteclick)); + idx := 0; + r[idx++] := array("type":"menu","caption":"打开tsf文件","onclick":thisfunction(OpenClass)); + 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)); return r; end @@ -958,6 +964,63 @@ type TDPanelForm = class(TDForm) inherited; 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 type TComponentMenu= class(tmenu) //设计器右键菜单 @@ -1935,63 +1998,7 @@ type TDMainMenu = class(TDMenuBase) 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) {** @explan(说明) action设计器控件 %% diff --git a/designer/utslvcldebuger.tsf b/designer/utslvcldebuger.tsf index b45cd2f..02678d6 100644 --- a/designer/utslvcldebuger.tsf +++ b/designer/utslvcldebuger.tsf @@ -723,6 +723,7 @@ type TTslDebuga=class(TCustomControl) if n then begin //echo "\r\n====add:",usr,"====",n,"===",idx; + //echo "\r\n>>",(idx+1)," ",item.ScriptPath; dbgsetbreak(FConnectchannel,usr,n,idx+1); end end