本站首页    管理页面    写新日志    退出


«December 2025»
123456
78910111213
14151617181920
21222324252627
28293031


公告
================

注会练习软件
http://www.cpasoft.com.cn
我的注会软件官网

http://blog.163.com/abc7105@126/

 

 


哈哈,热爱快“过气”的DELPHI


我的分类(专题)

日志更新

最新评论

留言板

链接

Blog信息
blog名称:注册会计师(注会)练习软件
日志总数:398
评论数量:116
留言数量:27
访问次数:3282784
建立时间:2005年6月6日




[borland eco 技术]制作主页面菜单调用eco各模块的mygeneration模板(原)
软件技术

吕向阳 发表于 2006/9/4 7:59:47

<%Dim bFirstDim nameDim pnameDim objTableDim objColumnDim tableNamesDim databaseNameDim tableName'dim ecospacedim jj' Grab the namespace namespace = input.Item("txtNamespace")Set tableName = input.Item("lstTables") MyMeta.Language = input.Item("cmbLanguages")MyMeta.DbTarget = "OleDb" ' Grab the choices the user made in our UI Script (see Interface Code tab)Set tableNames = input.Item("lstTables")'ecospace=input.item("txtecospace") databaseName  = input.Item("cmbDatabase")Set database = MyMeta.Databases(0)%>unit fmmainmenu; interface uses  System.Drawing, System.Collections, System.ComponentModel,  System.Windows.Forms, System.Data  <%' Loop through the tables the user select and generate the stored procs and save them to diskFor intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%>  ,fm<%=objtable.alias%><%next %>; type  tmainmenu = class(System.Windows.Forms.Form)  {$REGION 'Designer Managed Code'}  strict private    /// <summary>    /// Required designer variable.    /// </summary>    Components: System.ComponentModel.Container;    MainMenu1: System.Windows.Forms.MainMenu;    MenuItem1: System.Windows.Forms.MenuItem;    MenuItem2: System.Windows.Forms.MenuItem;    <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  output.write"    MenuItem"&k&":System.Windows.Forms.MenuItem;" &vbcrlf k=k+1next %>          /// <summary>    /// Required method for Designer support - do not modify    /// the contents of this method with the code editor.    /// </summary>    procedure InitializeComponent;    <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   output.write"    procedure MenuItem"&k&"_Click(sender: System.Object; e: System.EventArgs);" &vbcrlf k=k+1next %>     {$ENDREGION}  strict protected    /// <summary>    /// Clean up any resources being used.    /// </summary>    procedure Dispose(Disposing: Boolean); override;  private    { Private Declarations }      <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  %>    procedure doform<%=objtable.alias%>();<% k=k+1next %>   public    constructor Create;  end;   [assembly: RuntimeRequiredAttribute(TypeOf(Tmainmenu))] implementation {$AUTOBOX ON} {$REGION 'Windows Form Designer generated code'}/// <summary>/// Required method for Designer support -- do not modify/// the contents of this method with the code editor./// </summary>procedure tmainmenu.InitializeComponent;type  TArrayOfSystem_Windows_Forms_MenuItem = array of System.Windows.Forms.MenuItem;begin  Self.MainMenu1 := System.Windows.Forms.MainMenu.Create;  Self.MenuItem1 := System.Windows.Forms.MenuItem.Create;  Self.MenuItem2 := System.Windows.Forms.MenuItem.Create;    <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%>  Self.MenuItem<%=k%> := System.Windows.Forms.MenuItem.Create;<%k=k+1next %>       //   // MainMenu1  //   Self.MainMenu1.MenuItems.AddRange(TArrayOfSystem_Windows_Forms_MenuItem.Create(Self.MenuItem1,           Self.MenuItem2));  //   // MenuItem1  //   Self.MenuItem1.Index := 0;  Self.MenuItem1.MenuItems.AddRange(TArrayOfSystem_Windows_Forms_MenuItem.Create(  <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 bfirst=trueFor intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ if bfirst then  output.write "  Self.MenuItem" & k  bfirst=false else   output.write "  ,Self.MenuItem" & k  end if k=k+1next %>));    Self.MenuItem1.Text := '功能';  //   // MenuItem2  //   Self.MenuItem2.Index := 1;  Self.MenuItem2.Text := '系统';  //   // MenuItem3  //       <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     output.write "  Self.MenuItem" & k & ".Index := 0;" &vbcrlf    output.write "  Self.MenuItem" & k & ".Text := '" & objtable.alias &"';" &vbcrlf    output.write "  Include(Self.MenuItem" & k & ".Click, Self.MenuItem" & k &"_Click);" &vbcrlf  k=k+1next %>      //   // TWinForm  //   Self.AutoScaleBaseSize := System.Drawing.Size.Create(6, 14);  Self.ClientSize := System.Drawing.Size.Create(536, 358);  Self.Menu := Self.MainMenu1;  Self.Name := 'TWinForm';  Self.Text := 'WinForm';end;{$ENDREGION} procedure tmainmenu.Dispose(Disposing: Boolean);begin  if Disposing then  begin    if Components <> nil then      Components.Dispose();  end;  inherited Dispose(Disposing);end;     <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp))%> procedure tmainmenu.doform<%=objtable.alias%>;var aform:form<%=objtable.alias%>;beginaform:=form<%=objtable.alias%>.create();try   aform.showdialog;finally  aform.dispose;end;end;  <%k=k+1next %> constructor tmainmenu.Create;begin  inherited Create;  //  // Required for Windows Form Designer support  //  InitializeComponent;  //  // TODO: Add any constructor code after InitializeComponent call  //end; <%' Loop through the tables the user select and generate the stored procs and save them to diskk=3 For intLp = 0 To tableNames.Count - 1 set objTable = database.Tables(tablenames.item(intLp)) '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' Now we have the table that we desire to build a Business Object From, let us begin.'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     output.write"procedure tmainmenu.MenuItem"&k&"_Click(sender: System.Object; e: System.EventArgs);" &vbcrlf    output.write"begin" &vbcrlf      output.write"  doform" & objtable.alias &"();" &vbcrlf    output.write"end;" &vbcrlf &vbcrlf  k=k+1next %> end. ==================================================************************************************** <%  ' Save the output file for this Table Dim filename filename = input.item("txtPath")  Dim length Dim pos lenth = Len(filename) pos = InStrRev(filename, "\")  If Not pos = lenth Then  filename = filename & "\" End If  filename = filename & "mainmenu.pas"  output.save filename, false buffer = buffer & output.text output.clear'Next '  tableName  output.write buffer %> <% '===========================================================================' These are support routines called by the above scirpt'===========================================================================Function GetAlias(objColumn) Dim name name = TrimSpaces(objColumn.Alias) GetAlias = UCase(Left(name, 1)) & Right(name, Len(name) -1)End Function Function GetName(objColumn) Dim name name = objColumn.Name GetName = UCase(Left(name, 1)) & Right(name, Len(name) -1)End Function Function TrimSpaces(str)  Dim tname Dim name Dim char Dim l  name = "" tname = str l = Len(tname)  For j = 1 To l  char = Mid(tname, j, 1)  If Not char = " " Then   name = name & char  End If Next  TrimSpaces = nameEnd Function%>


阅读全文(1597) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 1.125 second(s), page refreshed 144806384 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号