David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Hi, I'm still making tests. I put a list view in a Micro Four User Control which is contained in a Micro Four Form and the time of loading is 2800 ms. When I put directly the same list in a Micro Four Form, the time is about 450 ms. What are the reasons of this difference ? Best regards David
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Thanks for your help Trent, I follow your method and it's work. But if I want to do the same by code and not by the designer, I don't manage to laod my list. Do I forget something in the code I posted before ? David
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
Gotcha....yes, you can do this in code, but you will have to do it in the OnLoad prior to the MyBase.OnLoad gets called so that the translations take place in the natural or expected order. This is actually something that we do a bit ourselves.
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
In which OnLoad ? In the form or in the user control ?
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
Really either. It depends on what you are trying to accomplish with the user control. But if you add this before the MyBase.OnLoad method when overriding the OnLoad of the form, you will be fairly certain to create the translations before any translations take place.
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Hi Trent, In fact, I want to use User Control to re use them in several screens. So I want to use code to create dynamicly my user controls and I don't manage to create translations between my form and my user control. When I put my user control in my form on the designer it works correctly. Nevertheless, when I do the same by code by creating myself translations in the Form_Load(), it doesn't work. I put code before the InitializeComponent() and after but the result is the same. What can I do ? Thanks David
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
What can I do ? Well, let's go at it from this perspective. The BOs get translated within the Load of the form. The SF users controls also have a property that exposes which object from which to translate. I am not answering from a machine with VS on it (long story), but the user control has a property called TranslationObject (I think), but it will be iin the same category as the BOTranslations property of the UserControl. You can set this to the form (or even set it in code) and it may resolve your problem. If not, you can also implement the IParentFormLoading interface to control the initialization of the control. But let's start with the first before we get into the second.
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Hello Trent, Here is my code. public partial class Form1 : MicroFour.StrataFrame.UI.Windows.Forms.StandardForm{ private ClientBO _clientBO;private BusinessObjectTranslationItem _BOTranslationItem1 = new BusinessObjectTranslationItem();private ucClient _ucClient; public Form1() { InitializeComponent(); _clientBO = new ClientBO(); _ucClient = new ucClient(); _clientBO.ParentContainer = this; _clientBO.SynchronizingObject = this; this.PrimaryBusinessObject = _clientBO; this.Width = 1000; this.Height = 750; this.WindowState = FormWindowState.Normal; _BOTranslationItem1.DestinationBusinessObject = "_ucClient.clientBO1"; _BOTranslationItem1.SourceBusinessObject = "Form1._clientBO"; _ucClient.BOTranslations.AddRange(new MicroFour.StrataFrame.UI.Windows.Forms.BusinessObjectTranslationItem[] { _BOTranslationItem1}); _ucClient.Dock = System.Windows.Forms.DockStyle.Fill; _ucClient.ParentContainer = this; _ucClient.TranslationObject = this; } private void Form1_Load(object sender, EventArgs e) { _ucClient.Visible = true; _ucClient.OnFermerFenetre += new EventHandler(_ucClient_OnFermerFenetre); this.Controls.Add(_ucClient); } void _ucClient_OnFermerFenetre(object sender, EventArgs e) { ((MicroFour.StrataFrame.UI.Windows.Forms.UserControl)(sender)).ParentForm.Close(); } } I already set the TranslationObject property of my user control to my form. So, I will implement the IParentFormLoading interface to control the initialization of the control as you said. David
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
I really think that something is missing. I don't think that the IParentFormLoading event will be your solution from looking at your code. We are in the field training again this week, so our time is a bit limited. However, instead of going back and forth, just create a simple sample and then we will take a look instead of going back and forth via the forum.
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Hi Trent, I send you a sample project. I put the 2 examples. One with my user control created directly on the form by the designer which works. The other in which I create the user control and BOTranslation in the code. David
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
Hi Did you have the time to test my sample ? Regards, David
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
I will take a look at this soon, but we have just gotten back from being on the road and have a lot going on and we also have a lot of people out on vacation, so we are still trying to catch up. Thank you for being patient.
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
No worry Trent I just want to know to organize my work. I will work with Strataframe for many years so I have time
|
|
|
David Daragon
|
|
Group: Forum Members
Posts: 54,
Visits: 249
|
|
|
|