| 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%> |
|
|