PDA

View Full Version : Minimize window as a button



talha06
21 Jun 2012, 7:15 AM
Hello everyone,

I'm trying to minimize windows as a button at a taskbar - which is actually a toolbar but I couldn't add button dynamically to the taskbar. I tried calling doLayout function but it didn't work too.
Here's what I tried - any helps will be appreciated a lot!
Thanks in advance.
T


Variables :
win : The window that will be minimized
taskbar : A toolbar that is rendered at south region of my viewport

win.addListener('minimize', function(win, eOpts) {
var newButton = Ext.create('Ext.button.Button', {
text : win.title,
handler : function() {
win.show();
}
});
taskbar.insert(0, newButton);
taskbar.doLayout();
viewport.doLayout();
win.hide();
});

scottmartin
21 Jun 2012, 8:37 AM
Minimize window as a button

I am not sure I understand your request. Do you mean the following?



Ext.onReady(function() {
Ext.create('Ext.Button', {
id: 'button',
text: 'Click to show dialog ...',
handler: function() {
Ext.Msg.show({
animateTarget: 'button',
title: 'Window',
msg: 'Close to return ...'
});
},
renderTo: Ext.getBody()
})
});‚Äč


Regards,
Scott.

talha06
21 Jun 2012, 8:42 AM
Hi Scott,

In short, I want to add an 'minimize' event to window that will add a button to a toolbar after minimizing.

ramana_l_v
21 Jun 2012, 11:41 AM
Add these config to the window and it would get you the desired behavior
collapseDirection: 'bottom',
collapsed: true,
collapsible: true

or

If you need a button instead of window title you can add a hidden button in toolbar and on window close(hide) show the button and on button click you can show the window and hide the button

Thanks

talha06
21 Jun 2012, 11:15 PM
Add these config to the window and it would get you the desired behavior
collapseDirection: 'bottom',
collapsed: true,
collapsible: true

or

If you need a button instead of window title you can add a hidden button in toolbar and on window close(hide) show the button and on button click you can show the window and hide the button

Thanks
The difference is that I'm adding buttons dynamically(when a window is opened). Actually now the button is added to toolbar but I'm not able to see it unless I resize the view or close/re-open some embedded window like Chrome Developer Tools or Firebug.. It is a rendering problem maybe a bug.