PDA

View Full Version : about window max..



suhyun jeon
4 Aug 2009, 11:36 PM
Hello. Nice to meet you.
My project is GWT and GXT developing now.
I wanna WINDOW double click is maximum.
but I don't know method.

Doing attach photo. Look please.
http://blogfiles14.naver.net/20090805_285/mcjura00_1249457512311_yHM37Q_jpg/result_2009_7_3_16_31_48_125_2.jpg

help me please.

Animal
4 Aug 2009, 11:51 PM
Wrong forum folder.

Arno.Nyhm
7 Aug 2009, 5:00 AM
I wanna WINDOW double click is maximum.

at first you can use the Window.html#setMaximizable(boolean) Method. this shows a icon to maximize the window.

http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#setMaximizable(boolean) (http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#setMaximizable%28boolean%29)


to make it with a doubleclick you have to try out to find if an doubleclick event is fired by header or window and then use the maximize/minimize functions

http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#maximize() (http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#maximize%28%29)
http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#minimize() (http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#minimize%28%29)
http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#isMaximized() (http://extjs.com/deploy/gxtdocs/com/extjs/gxt/ui/client/widget/Window.html#isMaximized%28%29)

Arno.Nyhm
7 Aug 2009, 5:54 AM
i try it out and this are the code for you:



getHeader().addListener(Events.Render, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
getHeader().el().addEventsSunk(Event.ONDBLCLICK);
}
});
getHeader().addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
if (isMaximized()) {
restore();
} else {
maximize();
}
}
});full working example:



package org.yournamehere.client.forum.code.snippets;

import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Event;

/**
*
* @author anonym
*/
public class ForumThread76612 implements EntryPoint {

public void onModuleLoad() {
Window window = new MyFormWindow();
window.show();
}

class MyFormWindow extends Window {

MyFormWindow() {
setMaximizable(true);
add(new Html("Test"));

getHeader().addListener(Events.Render, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
getHeader().el().addEventsSunk(Event.ONDBLCLICK);
}
});
getHeader().addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {

public void handleEvent(BaseEvent be) {
if (isMaximized()) {
restore();
} else {
maximize();
}
}
});
}
}
}

Arno.Nyhm
7 Aug 2009, 6:03 AM
if you like not to copy it always in your window then you can extend the windowclass and add this code or look here for a helper class to apply the functionality:


WindowMaximizeOnHeaderDoubleclick
http://www.extjs.com/forum/showthread.php?t=76937

Arno.Nyhm
7 Aug 2009, 7:09 AM
it looks there is a shorter solution there:

I wanna WINDOW double click is maximum.
http://www.extjs.com/forum/showthread.php?p=369321#post369321