I have a MDI window application, before closing the main form I first check to see if there is any child form opened, if so then the main form doesn't close. It is working fine except that some times (I don't know exactly when) after opening and closing any child forms there is still one form in OwnedForms, when I see the details of OwnedForms[0].Value it shows something like this: {Infragistics.Win.ToolTipFormEx, Text: }. There is not opened any form except that one and it is not visible to the user, so the main form doesn't close. Any idea? Here is the code I use to check before closing the main form. I apologize if this is not the right forum but I don't know wich one to use for this.
private void MainForm_Closing( object sender, System.ComponentModel.CancelEventArgs e ){ if( this.OwnedForms.Length > 0 ) { e.Cancel = true; } }
ToolTipFormEx is the form that is used to display Infragistics Tooltips from ToolTipManager or some other Infragistics control on the form. This form is not an MDI child and should only be in the OwnedForms collection which it is displayed. So perhaps you have a tooltip displayed when you are clicking the close button on the form.
It sounds to me like the simplest thing to do would be to simply ignore forms of that type - or perhaps any form that does not have an MDIParent.
Hi Mike,
I got the same problem but in a different way.
We got our main form and two subForm's opened by it. Subform1 produces no errors, but SubForm2.
Before open any subForm, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain) [ONLY 1 item is present].
After open Subform1, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain), SubForm1Title (Type:SubForm).
After closing SubForm1, our Application.OpenForms shows following correct hierarchy again: MainFormTitle (Type:FormMain) [ONLY 1 item is present].
After open Subform2, our Application.OpenForms shows following hierarchy: MainFormTitle (Type:FormMain), "" (Type:Infragistics.Win.TooltipFormEx), SubForm2Title (Type:SubForm).
After closing SubForm2, our Application.OpenForms shows following incorrect hierarchy again: MainFormTitle (Type:FormMain), "" (Type:Infragistics.Win.TooltipFormEx)
Because we get now an incorrect OpenForms hierarchy, our MainForm disappears into the background behind all other opened application windows (if any present).
This happens only if Infragistics.Win.TooltipFormEx is contained in the list.
Yes, currently we're using an TooltipManager for subForm2 and we can not remove it.
But it isn't acceptable for us that our mainForm moves into background every time we're showing (better closing) an form that includes an tooltipManager! And removing all tooltipManager from forms isn't a solution ;)
Any idea here? We expected the normal behavior here....open a Form from MainForm -> show subform -> close subForm -> show mainForm again
Well, if you can post a small sample project demonstrating this behavior, we could take a look and see if there's anything we can do to correct this. It's not clear from the information you posted here when the tooltip is being displayed and what's triggering it.
But it seems to me like all you probably need to do to work around this is to simply close (Hide) the tooltip before you close subform 2.
yeah you're right. But we show a tooltip only if we need it ;)
But the TooltipFormEx is first time present ini Application.OpenForms if you call TooltipManager.showTooltip(). From this time on, there is no way to get it out of it.
i would say, this is an bug...my opinion ;) Cause there is no form opened (i know tooltip uses a formBase for this, but if we didn't show a tooltip why is it inside the collection?)
No matter if you called tooltipManager.hideTooltip() or not, it won't get removed from Application.OpenForms until the tooltipManager gets disposed.
Currently at this time we got a workaround to fix this, but its not really intuitiv :(
Hi TR,
I tried this out to see if I could reproduce the issue, but I'm a bit confused about exactly what's happening. It looks to me like you are saying that the Tooltip form is a child of the main MDI form. How does that happen? What control are you passing or assigning to the tooltip? Is the tooltip being shown for the child form itself? That seems a little unusual.
Perhaps you could create a small sample project the demonstrates what you are doing so I can take a look. If the ToolTip form is hanging around as a child of the form for which it was shown, then that might be something we can change. We are probably just re-using the same form for efficiency. But we don't necessarily have to do that, or even if we do, it doesn't necessarily have to remain a child of the original form. But I need to be able to reproduce the issue in order to fix it.