Forum: Multi-Language Add-In for Visual Studio

Handling Telerik controls

Germany

The Telerik components have caused some difficulty for the function ml_UpdateControls().

The code that they generate in the InitializeComponent() function does not necessarily generate a Form-Level variable for each control. For some controls, is simply uses a local variable within InitializeComponent() and then adds it to the Controls collection for the form.

For example

private void InitializeComponent()
{
...
  System.Windows.Forms.Label customerIDLabel;
...
  customerIDLabel = new System.Windows.Forms.Label ( );
...
  // 
  // customerIDLabel
  // 
  customerIDLabel.AutoSize = true;
  customerIDLabel.Location = new System.Drawing.Point ( 26, 330 );
  customerIDLabel.Name = "customerIDLabel";
  customerIDLabel.Size = new System.Drawing.Size ( 68, 13 );
  customerIDLabel.TabIndex = 2;
  customerIDLabel.Text = "Customer ID:";
...
  this.Controls.Add ( customerIDLabel );
...
}

In this case, it is impossible to refer to the control later as customerIDLabel, because this is a local variable in InitializeComponent().

This effectivly breaks the code previously generated in the function ml_UpdateControls().

Starting with version 4.53.0022, the Add-In generates slightly different code, for example

private void ml_UpdateControls()
{
...
  this.Controls["customerIDLabel"].Text = ml.ml_string ( 67, "Customer ID:" ) ;
...
}


This code is only generated if there is no equivalent form level variable for the control. Otherwise the same code as before is generated.

I don't think that this will affect many people anyway, unless I have broken something, so let me know if anything is not working properly.

Phil