Print Page | Close Window

ReCreateReparented property

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Suite Pro
Forum Description: Topics Related to Codejock Suite Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=23196
Printed Date: 26 April 2024 at 12:59am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ReCreateReparented property
Posted By: Lodep59
Subject: ReCreateReparented property
Date Posted: 10 November 2016 at 5:46pm
Hi,

Can someone explain me what is the "recreatereparented" property ?
The help tells nothing about it.

Thanks.


-------------
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)



Replies:
Posted By: olebed
Date Posted: 11 November 2016 at 9:20am
Hi,

ReCreateReparented property (of every control which derived from CXTPOleControl) relates to   http://msdn.microsoft.com/library/53e95299-38e8-447b-9c5f-a381d27f5123.aspx#colecontrol__reparentcontrolwindow" rel="nofollow - COleControl::ReparentControlWindow

There are some problems with standard method, so we add own implementation. If set this property to True or ReCreateReparentedControls property in GlobalSettings (e.g. Codejock.ShortcutBarGlobalSettings) then  will be used our implementation, else standard.

Regards,
 Oleksandr Lebed


Posted By: Lodep59
Date Posted: 16 November 2016 at 4:52pm
Thanks.
Is it logical to let the user (us) access this property ? In other words, when should I use it ?


-------------
Product: Xtreme SuitePro (ActiveX) last version
Platform: Windows 7 Ultimate
Language: VB6 SP6 (FR)


Posted By: olebed
Date Posted: 17 November 2016 at 4:30am
Originally posted by Customer Customer wrote:

We also have a weird problem with our MDI child forms. When we set the MdiParent of the form to our MDI form, all of the standard form and control events that usually gets fired simply vanishes and does not get fired. All we do is use the following statement to set the MDI parent

objForm.MdiParent = this.frmMDI;

And this gets done after the form constructor is completed and returned. By doing this, the entire application and form code goes crazy and nothing seems to fire in the order that it should fire. Can you please let us know if there is anything special that we need to do before these code lines. 

Originally posted by </span>Alexander Stoyan<span style=line-height: 16.8px;> Alexander Stoyan wrote:

We identified what causes this issue and Codejock components have nothing to do about this problem, neither your implementation. There are in fact 2 known issues causing this:
1. MDI windows in WinForms are designed in such a way they create an MDI child form without a parent window and then assign a parent window to it, something similar happens to all controls on an MDI child form - at the moment a control's window is created the parent handle is set to some internal window and later parent window changes for the control.
2. As long as some Codejock components are derived from standard Windows components, they derive the way those controls handle re-parenting. Some of them cache parent window handle on creation, some update later if WS_CHILD is changed, but all works differently. Here is exactly the problem we have with Edit control in this scenario - http://stackoverflow.com/questions/30708760/edit-control-doesnt-generate-wm-command-messages, so as you can see there is nothing we can really do about it.

However we did manage to do something. For the next update we have added a new optional behavior for re-parenting to all controls, by default it is disabled but it can be enabled either per control, e.g. myButton.ReCreateReparented = True or globally for all components from 1 library, e.g. SuiteControlsGlobalSettings.ReCreateReparentedControls = True. Every time a control is re-parented it checks both of the flags and if at least one is True the control re-creates itself for a new parent window handle. That was the only way to overcome this problem.

However this approach has a side effect - if a control has been configured and data added before re-parenting re-creating it will reset its state and data. For this purpose we have added a special event for each control that can be re-parented and it's called Recreated. The event handler can restore control state, e.g. your sample can be modified this way:

    public Form1()
    {
      InitializeComponent();

      // This enables control re-creating on re-parenting.
      new XtremeSuiteControls.SuiteControlsGlobalSettingsClass().ReCreateReparentedControls = true;
      // OR
      //this.axComboBox1.ReCreateReparented = true;
      //this.axFlatEdit1.ReCreateReparented = true;

      // This is to ensure combobox will contain all data if re-created.
      this.axComboBox1.ReCreated += (sender, e) => FillComboboxData();
      
      // This is to ensure combobox will contain all data if not re-created.
      FillComboboxData();
    }

    void FillComboboxData()
    {
      axComboBox1.AddItem("asfasd");
      axComboBox1.AddItem("basfasd");
      axComboBox1.AddItem("casfasd");
      axComboBox1.AddItem("dasfasd");
      axComboBox1.AddItem("easfasd");
      axComboBox1.AddItem("fasfasd");
      axComboBox1.AddItem("gasfasd");
      axComboBox1.AddItem("hasfasd");
      axComboBox1.AddItem("iasfasd");
      axComboBox1.AddItem("jasfasd");
      axComboBox1.AddItem("kasfasd");
    }
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net