Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
PopupControlContainer and ControlContainer errors with control references
posted

 I'm currently working on a project that's using the Infragistic ribbon controls.  The basic layout of the "main" form in the project is a form with a ribbon and a standard TabControl.  Once the application is started, it dynamically adds one of our custom controls into the first tab in the TabControl.  The idea is to use the tabs so we can have multiple instances of our custom control running all with different data.  In our custom control, we have a bunch of listboxes for selection and whatnot.  To clear up some space, we wanted to move these listboxes to the ribbon.  Currently, we're doing this by using the PopupControlContainer tool in the ribbon.  We have getters in the custom control so the main has direct references to the listboxes in the control.  So far so good.  The PopupControlContainer is working as intended and the controls are showing up in the correct places.

We wanted to add a way to "tear off" pages so that the user can view our control in multiple windows.  We achieved this by creating a new form with another ribbon.  This "tear off form" is an empty form with a ribbon.  When you "tear off," we create a new instance of the tear off form and move the custom control from the main to the tear off by saying "  frmTearOff.Controls.add(custom_control);  ".   Again, so far so good. The ribbon in the tear off has basically the same functionality as the ribbon in the main and the PopupControlContainer tools are displaying the information correctly.

 Here's where the problems start.   When we close the tear off page, we wanted the custom control to go back into the main window.  We achieved this by again, adding the control back to the main form.  frmMain.Controls.add(custom_control);   .  The problem now is that the PopupControlContanier's do not show the correct controls.  They do not show any controls at all (they are just blank drop downs).  I forgot to mention that we also have a regular ControlContainer and that too does not display the control.

 We thought that the problem had something to do with missing or corrupt references.  First we tried resetting the references via

PopupControlContainer.Control = null;
...
PopupControlContainer.Control = frmMain.getCustomControl();

and this worked...to an extent.  When you select a tab, we reset the ribbon to have all the functionality of the correct control.  We found if you left the selected tab on the guy that was torn off, this method fixed it.  If you changed tabs, however, and went back to the old tab that had returned from a tear off window, the controls were again empty.

I've already stepped through in debug mode and checked to see if it was setting the controls correctly and if the listboxes were even still in the custom_control and I can't seem to find the problem.  All hope is greatly appreciated.

Thanks.

 ---------

Edit - I feel as though I should add...
When you flip back and forth between the tabs, I have the PopupControlContainers changing their "Control" to be the version of the custom_control in the selected tab.  All the tabs load the PopupControlContainers properly except for the tab that was torn off via the method I explained before.  The ribbon starts to get all glitchy when that tab is selected.  It has trouble drawing itself.  If you need more of an explanation let me know.

Parents Reply Children
No Data