I have a MDI container form, and some child forms that update their title bar texts themselves, independently. After the Text property is changed on the child form, the new title bar text from the child is not updated in the window list menu when the menu is opened. This is the auto-generated window list provided by .NET via the MdiWindowListItem property.
The change only propagates when another event changes the window list physically (opening a new child, closing a child, switching to another child).
Is there a way to force an update of the window list programmatically? I already have some code in place to do menu enabling/disabling at the same time the child's title bar text is changed.
I tried the following with no success:
There don't seem to be any other remotely viable functions to call on the menu item, its parent ToolStrip, or the parent form that contains the menu system.
The above solution did not work for me. But I followed the link, and found this, which works perfectly:
private void windowMenu_DropDownOpening(object sender, EventArgs e)
{
if (this.ActiveMdiChild != null)
{
Form activeChild = this.ActiveMdiChild;
ActivateMdiChild(null);
ActivateMdiChild(activeChild);
}
}
Thank you!
You need to add a TextChanged event to the child form, with this handler:
private void childForm_TextChanged(object sender, EventArgs e) {
this.ActivateMdiChild( null );
this.ActivateMdiChild( sender as Form );
}
http://social.msdn.microsoft.com/forums/en-US/winforms/thread/a36b89aa-57aa-48b5-87a6-49fbddc9c92d
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With