Extjs Window Default Close Button - extjs

I have a button inside a panel that once clicked will call out a child window. I already created it and there are already items inside it. Once the child window is opened the parent panel will be disabled.
Inside the child window I have a Button that closes the window which will then enables the parent panel.
childWindow.close();
parent.enable();
My problem is the default close button on the Window on the upper right side of the window. If I click it it, I cannot enable the parent panel. it stays disabled, because of course I disabled it.
How do I enable the parent panel once it is closed using the default close button?

Place a listener to the close event of the "child" window inside your "main" window. The listener will work, even if it is disabled. In the following example I assume that the win ref is a reference of your "main" window while "child" is the one of your child.
openWin: function(child) {
child.on('close', reactivate, this);
child.show();
this.disable();
},
reactivate: function() {
this.enable();
}

If you want disable everything behind the window, use the modal config of Ext.window.Window
modal : Boolean
True to make the window modal and mask everything
behind it when displayed, false to display it without restricting
access to other UI elements.
Defaults to: false

Related

Destroying a contextmenu in ExtJS?

I noticed that every time I open and close (by clicking on a menu item or clicking at some area out of the menu) a contextmenu (Ext.menu.Menu) the <div>s won't get removed from the DOM, they somehow just get invisible.
How to change this?
You can try this to destroy entire component -
listeners: {
hide:function(menu, opt){
Ext.destroy(menu);
}
}
But you have to create Ext.menu.Menu, when click menu button next time.

Popup window and on close return the value to main page

As my form includes many actions I want to call a popup window to do some actions.
But after the submission of the popup window. I have to replace a div in parent window.
1)How can I call a popup window which is modal?
2)How can the parent window know the child window is closed? (so that I can replace the div with new data)
Please help me...
You can use the jquery modal window shown in this link
While using the modal window in the link you can see that there is an event function called beforeClose. In this event, you can use callback function to update the div in the parent window.

How do I invoke a modal window from a wpf page?

How do I invoke a modal window from a wpf page? Window.showDialog() makes the window modal when it is invoked from a parent Window, however when invoked from a Page, the modal behaviour disappears. I tried using a PopUp control, but it doesnt appear to be as customizable as a window.
I am not sure how are you calling the window, but calling new Window().ShowDialog() from within a page inside frame, makes the new window modal to the whole application.

Activating main window when button is clicked in a user control

I have a WPF user control with some buttons inside it. I need to intimate the main window when button click happens inside the WPF control. The main window has to initiate some actions upon receiving this message from the button click event inside the user control.
You can add a Click handler to all your Buttons, and in that Click handler, call the UserControl's OnClick method to generate a click event coming from the user control.
Check out Commands:
http://msdn.microsoft.com/en-us/library/ms752308.aspx

Popup window and context menu

I am using the ToolStripDropDown to host the user control as the pop-up window. The problem is when a context menu strip is displayed from within this pop-up window, the pop-up itself closes in the moment the context menu opens.
I have tried to subclass the ContextMenuStrip and added WS_EX_NOACTIVATE to CreateParams but nothing changed. First I thought that there is no way to do this since it is common behavior but then I tried to put a TextBox class onto the pop-up user control and invoke the Edit control context menu - and the parent pop-up window did not close.
What am I missing?
Had a similary Problem. On my UserControll was a toolstrip. When I pressed the toolsstripdropdownbutton the dropdown was shown but the popup disapeared.
The reason was that popup.Autoclose was true. After Setting to false the Popup is not closed any more.
ToolStripDropDown popup = new ToolStripDropDown();
popup.AutoClose = false; //Set to FALSE
popup.Margin = Padding.Empty;
popup.Padding = Padding.Empty;
ToolStripControlHost host = new ToolStripControlHost(userControl1);
host.Margin = Padding.Empty;
host.Padding = Padding.Empty;
popup.Items.Add(host);
popup.Show(button1, new Point(100,100));
Actual Solution should be the one in Martin's final comment:
Use ContextMenu Instead of ContextMenuStrip
That one worked for me, and the ToolStripDropDown no longer closes by itself when right clicking one of its content controls, like it should. We still need it to AutoClose, disabling AutoClose on ToolStripDropDown will do bad things, it is supposed to close on losing focus. Example: open any other app window, and the ToolStripDropDown will continue to appear on top

Resources