...
Code Block |
---|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ C:\gmSpec\Migrate\MSGridTest\proj\idf\FromIdl\GRID32.OCX.xml ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 <DescriptionFile> > 2 <library id="GRID32.OCX" 3 name="MSGrid" 4 uuid="A8B3B723-0B5A-101B-B22E-00AA0037B2FC" 5 netVersion="1.0" 6 source="GRID32.OCX" |
I prepare a RefactorLibrary called grid32.ocx.Winforms.Refactor.xml to organize the declarative migration rules that will take this to gmRTL.MSGrid.
...
I can associate the RefactorLibrary rules with the IDF using Registry/MigFile before the Compile in the translation script.
Code Block |
---|
<Registry type="MigFile" source="grid32.ocx" target="grid32.ocx.Winforms.Refactor" /> |
Supposing we require a deeper migration, for example authoring a boolean assignment in designer code based on the FixedRows property of each grid control as specified in the VB6 Form header.
For reference, here are the migration handlers/helpers implementing those rules:
Code Block |
---|
int Grid(int context,int ctlRoot,int iStart) { // migration event handler: called by translation process haswhen anit encounteredencounters an MSGrid.Grid class member reference string propName; string Value; string Name; if(context == EventType.ControlValue) { propName = Store.GetIdent(iStart); Value = Write.Clear(); Name = Store.GetName(ctlRoot); if(propName == "FixedRows") Grid_FixedRows(Name,Value); else return 0; return 1; } if(context != EventType.InitializeComponent) return 0; return 1; } void Grid_FixedRows(string Name, string Value) { // migration event helper: called from handler when Authoring aAuthoringthe FixedRows property in the designer migClassMigClass if (Value > 0) { System.LogMessage("Grid_FixedRows:" + Name + "," + Value); if(Select.Dialect == Dialects.vbn) { Write.Line("Me." + Name + ".RowHeadersVisible ColumnHeadersVisible= True"); } else { Write.Line("this." + Name + ".RowHeadersVisible ColumnHeadersVisible= true;"); } } } |
To engage the migration handler, I need to attach gmSL code block to the RefactorLibrary. I must do this in IDF my modifying the RefactorLibrary file .as follows:
1) Add an event attribute to the top level Refactor element
...