Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


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 aAuthoringAuthoring the 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 = True");
     }
     else
     {
        Write.Line("this." + Name + ".RowHeadersVisible = true;");
     }
   }
}

...