Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Won't show any forms

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
david@windward.net



Joined: 14 Nov 2008
Posts: 14

PostPosted: Tue Nov 25, 2008 7:07 pm    Post subject: Won't show any forms Reply with quote

Hi;

Ok, we purchased the product and ran it on our main program. It will not show any of the forms to be translated. The problem appears to be that all of our forms have constructors that are passed a parameter. VS 2008 does fine with that but Globalizer does not.

This eliminates a major reason we purchased Globalizer. Do you have any plans to display forms with parameters passed to their constructors in the near future?

thanks - dave
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Nov 25, 2008 9:47 pm    Post subject: Reply with quote

The solution is to add a default parameterless constructor to forms/controls that you wish to be able to preview using Globalizer. Here is the section from the help on this topic:

Quote:
Previewing Forms and Controls

Unlike many other localization tools, the Form preview displayed by Globalizer.NET is not a simulation of your form layout based on the resx file. Instead Globalizer.NET leverages the power of .NET Reflection to run your actual application code to display the form or control. This means that Globalizer.NET is able to display previews of complex Forms that use custom controls which typically can not be handled by other tools. Because Globalizer.NET runs the actual code for the form you need to follow a few simple guidelines when developing forms and controls which you want Globalizer.NET to preview:

* The Form/Control must have a default parameterless constructor in order for Globalizer.NET to be able to create it
The default constructor (and OnLoad method) should not invoke code that depends on external initialization (since this may cause an exception when Globalizer.NET attempts to create the form/control without the intialization having occurred)
* Event handlers for the control/form should not invoke code that depends on external initialization unless they have checked that the initialization has occurred. This prevents the user seeing errors when they click on buttons or controls within the form being previewed.

One simple coding technique to achieve the above conditions, for forms/controls that do need to access externally initialized data, is to provide a second constructor that takes the data object as a parameter. The form/control saves this in a member variable and each event handler that needs to access the data simply returns if the member variable is uninitialized (ie Null/Nothing).

If your Form constructor or event handlers do happen to invoke code that depends on external initializations, and this causes an exception to occur, then the Developer Edition of Globalizer.NET will catch the exception and display full details about the exception including stack trace and description. This enables you to insert the appropriate checks in your code to avoid the problem. The Translators Edition of Globalizer.NET also catches exceptions if they occur - but displays a less verbose (and less scary) message indicating that the preview for the Form or Control can not be displayed.


Visual Studio is able to display forms that don't have parameterless constructors in the designer because it has access to the source code (it serializes/deserializes the code in InitializeComponent). Even Visual Studio cannot display a preview if the base class does not have a default constructor. We can't create an instance of forms using custom constructors which take parameters as we have no idea what valid parameters for the constructors would be.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group