Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Suite Pro
  New Posts New Posts RSS Feed - ReCreateReparented property
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ReCreateReparented property

 Post Reply Post Reply
Author
Message
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 202
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post Topic: ReCreateReparented property
    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)
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 830
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post Posted: 11 November 2016 at 9:20am
Hi,

ReCreateReparented property (of every control which derived from CXTPOleControl) relates to  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
Back to Top
Lodep59 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 03 April 2008
Status: Offline
Points: 202
Post Options Post Options   Thanks (0) Thanks(0)   Quote Lodep59 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
olebed View Drop Down
Admin Group
Admin Group
Avatar

Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 830
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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");
    }
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.109 seconds.