Closed GoogleCodeExporter closed 9 years ago
Hi,
try this, I am not sure about the implementation but it works for me (tested
with
firefox on linux, HOSTED MODE DOES NOT WORK)
import org.gwt.mosaic.core.client.DOM;
import org.gwt.mosaic.ui.client.InfoPanel;
import org.gwt.mosaic.ui.client.Viewport;
import org.gwt.mosaic.ui.client.layout.LayoutPanel;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.event.dom.client.KeyDownHandler;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.event.dom.client.KeyUpEvent;
import com.google.gwt.event.dom.client.KeyUpHandler;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.ui.Focusable;
import com.google.gwt.user.client.ui.impl.FocusImpl;
public class Test implements EntryPoint {
static class FocusLayoutPanel extends LayoutPanel implements Focusable,
HasAllKeyHandlers {
private static final FocusImpl impl = FocusImpl.getFocusImplForPanel();
public FocusLayoutPanel() {
super(impl.createFocusable());
// Hide focus outline in Mozilla/Webkit/Opera
DOM.setStyleAttribute(getElement(), "outline", "0px");
// Hide focus outline in IE 6/7
DOM.setElementAttribute(getElement(), "hideFocus", "true");
}
public int getTabIndex() {
return impl.getTabIndex(getElement());
}
public void setAccessKey(char key) {
impl.setAccessKey(getElement(), key);
}
public void setFocus(boolean focused) {
if (focused) {
impl.focus(getElement());
} else {
impl.blur(getElement());
}
}
public void setTabIndex(int index) {
impl.setTabIndex(getElement(), index);
}
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) {
return addDomHandler(handler, KeyUpEvent.getType());
}
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
return addDomHandler(handler, KeyDownEvent.getType());
}
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
return addDomHandler(handler, KeyPressEvent.getType());
}
}
public void onModuleLoad() {
Viewport v = new Viewport();
FocusLayoutPanel f = new FocusLayoutPanel();
v.getLayoutPanel().add(f);
f.addKeyDownHandler(new KeyDownHandler() {
public void onKeyDown(KeyDownEvent event) {
if (122 == event.getNativeKeyCode()) {
InfoPanel.show("F11", "Hello!");
event.preventDefault();
}
}
});
v.attach();
}
}
Original comment by georgopo...@gmail.com
on 17 Jun 2009 at 1:27
Hi,
Thanks for your reply.
I want to hide web browser menu(File,Edit,View vb).
F11 hiding them, so I want to fire an event that has effect of F11.
Your code for prevent event with keyCode F11.
I want that my poject starts as pressed F11.
Original comment by a_inan...@yahoo.com
on 17 Jun 2009 at 2:04
I don't think you can switch the current window to fullscreen with JavaScript
(GWT).
Original comment by georgopo...@gmail.com
on 17 Jun 2009 at 6:19
Thanks for your effort.
Original comment by a_inan...@yahoo.com
on 18 Jun 2009 at 8:46
Original comment by georgopo...@gmail.com
on 18 Jun 2009 at 10:39
Original issue reported on code.google.com by
a_inan...@yahoo.com
on 17 Jun 2009 at 9:06