Discussion:
window.maximize event problem with getWidth() ???
(too old to reply)
media
2016-04-16 12:12:22 UTC
Permalink
Hi everybody,

is it possible to read the current window width in a maximize event?

the value win.getWidth() has the old value and i need the new window width.

I have this code:

var win = new qx.ui.window.Window("Window getWidth Problem please
maximize!");
win.setWidth(300);
win.setHeight(200);
win.setShowMinimize(false);

win.addListener("maximize",function(e) {
alert(win.getWidth());
});

win.addListener("resize",function(e) {
alert(win.getWidth());
});

this.getRoot().add(win, {left:20, top:20});

win.open();


playground :

http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%22var%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522Window%2520getWidth%2520Problem%2520please%2520maximize!%2522%29%253B%250Awin.setWidth%28300%29%253B%250Awin.setHeight%28200%29%253B%250Awin.setShowMinimize%28false%29%253B%250A%250Awin.addListener%28%2522maximize%2522%252Cfunction%28e%29%2520%257B%250A%2520%2520%2520%2520alert%28win.getWidth%28%29%29%253B%250A%257D%29%253B%250A%2520%2520%2520%2520%250Awin.addListener%28%2522resize%2522%252Cfunction%28e%29%2520%257B%250A%2520%2520%2520%2520alert%28win.getWidth%28%29%29%253B%250A%257D%29%253B%250A%250Athis.getRoot%28%29.add%28win%252C%2520%257Bleft%253A20%252C%2520top%253A20%257D%29%253B%250A%250Awin.open%28%29%253B%22%2C%20%22mode%22%3A%22ria%22%7D


Is that possible and if, how can it be done?

Thank you all and greetings
media



--
View this message in context: http://qooxdoo.678.n2.nabble.com/window-maximize-event-problem-with-getWidth-tp7588272.html
Sent from the qooxdoo mailing list archive at Nabble.com.
voger
2016-04-16 12:40:33 UTC
Permalink
Well, this was a bit surprise for me too because I thought that
"maximize" is fired **after** the widow is maximized. It seems this is
not the case. So correctly you are using the "resize" event. To get the
dimensions and location you will need to call getBounds().

Here is an example
http://tinyurl.com/z5hhhtm
Post by media
Hi everybody,
is it possible to read the current window width in a maximize event?
the value win.getWidth() has the old value and i need the new window width.
var win = new qx.ui.window.Window("Window getWidth Problem please
maximize!");
win.setWidth(300);
win.setHeight(200);
win.setShowMinimize(false);
win.addListener("maximize",function(e) {
alert(win.getWidth());
});
win.addListener("resize",function(e) {
alert(win.getWidth());
});
this.getRoot().add(win, {left:20, top:20});
win.open();
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%22var%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522Window%2520getWidth%2520Problem%2520please%2520maximize!%2522%29%253B%250Awin.setWidth%28300%29%253B%250Awin.setHeight%28200%29%253B%250Awin.setShowMinimize%28false%29%253B%250A%250Awin.addListener%28%2522maximize%2522%252Cfunction%28e%29%2520%257B%250A%2520%2520%2520%2520alert%28win.getWidth%28%29%29%253B%250A%257D%29%253B%250A%2520%2520%2520%2520%250Awin.addListener%28%2522resize%2522%252Cfunction%28e%29%2520%257B%250A%2520%2520%2520%2520alert%28win.getWidth%28%29%29%253B%250A%257D%29%253B%250A%250Athis.getRoot%28%29.add%28win%252C%2520%257Bleft%253A20%252C%2520top%253A20%257D%29%253B%250A%250Awin.open%28%29%253B%22%2C%20%22mode%22%3A%22ria%22%7D
Is that possible and if, how can it be done?
Thank you all and greetings
media
--
View this message in context: http://qooxdoo.678.n2.nabble.com/window-maximize-event-problem-with-getWidth-tp7588272.html
Sent from the qooxdoo mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
media
2016-04-16 13:19:28 UTC
Permalink
Hi voger,
well it works!
thank you for your quick help.

regards
media



--
View this message in context: http://qooxdoo.678.n2.nabble.com/window-maximize-event-problem-getWidth-tp7588272p7588274.html
Sent from the qooxdoo mailing list archive at Nabble.com.

Loading...