Hi Ken,
I played a bit and found a trick to solve your problem. I used native
button to handle the "click" event ("click" works with mouse, SPACE and
RETURN). My example code works fine in a qooxdoo skeleton application,
but not with the playground (I don't know why).
<code>
qx.Class.define("testmc.Application",
{
extend : qx.application.Standalone,
members :
{
main : function()
{
this.base(arguments);
if (qx.core.Variant.isSet("qx.debug", "on"))
{
qx.log.appender.Native;
qx.log.appender.Console;
}
var button = new qx.ui.form.Button("First Button");
var doc = this.getRoot();
doc.add(button, {left: 200, top: 50});
button.addListenerOnce("appear", function(e) {
var domElement = qx.bom.Element.create("input", {type:"button"});
var bounds = button.getBounds();
qx.bom.element.Style.setStyles(domElement,
{
position: "absolute",
overflow: "hidden",
top: "0px",
left: "0px",
width: bounds.width + "px",
height: bounds.height+ "px",
opacity: 0.0,
zIndex: 20
});
var qxElement = new qx.html.Element();
qxElement.useElement(domElement);
button.getContainerElement().addAt(qxElement, 0);
qxElement.addListener("click", function(e) {
qx.bom.Window.open("about:blank");
});
button.addListener("focus", function() {
qxElement.focus();
});
});
}
}
});
</code>
I hope this solve your problem.
Cheers,
Chris
Am 23.12.2009 16:48, schrieb Ken MacDonald:
Thanks Chris,
I have a solution for FF now, I think.... what I'm trying to do now
for IE is capture the SPACE event, and fire a mouse event from the
handler in hopes that IE will see a mouse event and not do the popup
blocking. However, I can't seem to get the event listener to fire?!?!?
What am I doing wrong here?
Ken
Here's the playground:
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22%252F%252F%2520Create%2520a%2520button%250Avar%2520button1%2520%253D%2520new%2520qx.ui.form.Button(%2522First%2520Button%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522)%253B%250A%250A%252F%252F%2520Document%2520is%2520the%2520application%2520root%250Avar%2520doc%2520%253D%2520this.getRoot()%253B%250A%250Adoc.add(button1%252C%250A%257B%250A%2520%2520left%2520%253A%2520200%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D)%253B%250A%250A%252F%252F%2520Add%2520an%2520event%2520listener%250Abutton1.addListener(%2522mouseup%2522%252C%2520function(e)%2520%257B%250A%2520%2520alert(%2522Hello%2520Planet!%2522)%253B%250A%2520%2520%252F%252Fwindow.open(%2522%2522%252C%2520'_blank')%253B%250A%257D)%253B%250Abutton1.addListener(%2522keyup%2522%252C%2520function(e)%2520%257B%250A%2520%2520var%2520kid%2520%253D%2520e.getKeyIdentifier()%253B%250A%2520%2520if%2520(kid%2520%253D%253D%2520'Space')%2520%257B%250A%2520%2520%2520%2520alert(%2522Hello%2520Mars!%2522)%253B%250A%2520%2520%2520%2520button1.fireEvent('mouseup')%253B%250A%2520%2520%257D%250A%257D)%253B%250Abutton1.addListener(%2522keypress%2522%252C%2520function(e)%2520%257B%250A%2520%2520var%2520kid%2520%253D%2520e.getKeyIdentifier()%253B%250A%2520%2520if%2520(kid%2520%253D%253D%2520'Enter')%2520%257B%250A%2520%2520%2520%2520alert(%2522Hello%2520Venus!%2522)%253B%250A%2520%2520%2520%2520window.open(%2522%2522%252C%2520'_blank')%253B%250A%2520%2520%257D%250A%257D)%253B%250A%22%7D
<http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22%252F%252F%2520Create%2520a%2520button%250Avar%2520button1%2520%253D%2520new%2520qx.ui.form.Button%28%2522First%2520Button%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522%29%253B%250A%250A%252F%252F%2520Document%2520is%2520the%2520application%2520root%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250A%250Adoc.add%28button1%252C%250A%257B%250A%2520%2520left%2520%253A%2520200%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D%29%253B%250A%250A%252F%252F%2520Add%2520an%2520event%2520listener%250Abutton1.addListener%28%2522mouseup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Hello%2520Planet%21%2522%29%253B%250A%2520%2520%252F%252Fwindow.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%257D%29%253B%250Abutton1.addListener%28%2522keyup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520var%2520kid%2520%253D%2520e.getKeyIdentifier%28%29%253B%250A%2520%2520if%2520%28kid%2520%253D%253D%2520%27Space%27%29%2520%257B%250A%2520%2520%2520%2520alert%28%2522Hello%2520Mars%21%2522%29%253B%250A%2520%2520%2520%2520button1.fireEvent%28%27mouseup%27%29%253B%250A%2520%2520%257D%250A%257D%29%253B%250Abutton1.addListener%28%2522keypress%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520var%2520kid%2520%253D%2520e.getKeyIdentifier%28%29%253B%250A%2520%2520if%2520%28kid%2520%253D%253D%2520%27Enter%27%29%2520%257B%250A%2520%2520%2520%2520alert%28%2522Hello%2520Venus%21%2522%29%253B%250A%2520%2520%2520%2520window.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%2520%2520%257D%250A%257D%29%253B%250A%22%7D>
On Wed, Dec 23, 2009 at 8:27 AM, Christian Schmidt
<[email protected] <mailto:[email protected]>> wrote:
Hi Ken,
thank you for the snippet. I think this is a general problem with
the browser security and not a qooxdoo issue. I attached a html
file which use native code and the problem also occurs. I found
out that the FF3.5 allows the RETURN on "keypress" and SPACE on
"keyup". IE 7 and IE8 its bit ugly, it depends on the protocol. If
your use the file protocol, you can use "keypress" for RETURN and
SPACE. But if you use the http protocol only the RETURN works on
"keypress".
I'm sorry. I don't know if there is a trick to avoid the browser
blocker. Perhaps some one form the community knows it.
Using the qx.ui.window.Window is possible, but the problem is that
pdf plug-in always stay on top and I don't know how to solve this.
It seems to me that the z-index is ignored from the plug-in.
Cheers,
Chris
Here the playground code:
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22var%2520button%2520%253D%2520new%2520qx.ui.form.Button%28%2522Open%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522%29%253B%250A%250Avar%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522File%2522%29%253B%250Awin.setLayout%28new%2520qx.ui.layout.Canvas%28%29%29%253B%250Awin.setWidth%28400%29%253B%250Awin.setHeight%28500%29%253B%250Awin.setContentPadding%280%29%253B%250A%250Avar%2520file%2520%253D%2520new%2520qx.ui.embed.Iframe%28%2522http%253A%252F%252Fwww.education.gov.yk.ca%252Fpdf%252Fpdf-test.pdf%2522%29%253B%250Awin.add%28file%252C%2520%257Bedge%253A0%257D%29%253B%250A%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250Adoc.add%28button%252C%2520%257Bleft%253A%2520200%252C%2520top%253A%252050%257D%29%253B%250Adoc.add%28win%252C%2520%257Bleft%253A%252020%252C%2520
top%253A%252020%257D%29%253B%250A%250Abutton.addListener%28%2522execute%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520win.open%28%29%253B%250A%257D%29%253B%250A%22%7D
<http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22var%2520button%2520%253D%2520new%2520qx.ui.form.Button%28%2522Open%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522%29%253B%250A%250Avar%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522File%2522%29%253B%250Awin.setLayout%28new%2520qx.ui.layout.Canvas%28%29%29%253B%250Awin.setWidth%28400%29%253B%250Awin.setHeight%28500%29%253B%250Awin.setContentPadding%280%29%253B%250A%250Avar%2520file%2520%253D%2520new%2520qx.ui.embed.Iframe%28%2522http%253A%252F%252Fwww.education.gov.yk.ca%252Fpdf%252Fpdf-test.pdf%2522%29%253B%250Awin.add%28file%252C%2520%257Bedge%253A0%257D%29%253B%250A%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250Adoc.add%28button%252C%2520%257Bleft%253A%2520200%252C%2520top%253A%252050%257D%29%253B%250Adoc.add%28win%252C%2520%257Bleft%253A%252020%252C%2520top%253A%252020%257D%29%253B%250A%250Abutton.addListener%28%2522execute%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520win.open%28%29%253B%250A%257D%29%253B%250A%22%7D>
Am 22.12.2009 15:13, schrieb Ken MacDonald:
OK, here it is. Make sure that popup blocking is on - I used
FF3.5 to run this in the playground. Click on the button with the
mouse - a popup window (or new tab) should appear, and focus will
be on the button. Now hit the space bar and another new tab will
appear. Finally, hit RETURN and the popup blocker should appear
and no tab will be created.
In IE8, both SPACE and RETURN cause the popup blocker to appear,
neither works correctly. Mouseclick DOES work correctly, however.
Also, if this would work having the proper behavior (open new
tab, be able to display a .pdf) using a qooxdoo window.Window,
that would probably be OK as well.
Ken
http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22%252F%252F%2520Create%2520a%2520button%250Avar%2520button1%2520%253D%2520new%2520qx.ui.form.Button%28%2522First%2520Button%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522%29%253B%250A%250A%252F%252F%2520Document%2520is%2520the%2520application%2520root%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250A%250A%252F%252F%2520Add%2520button%2520to%2520document%2520at%2520fixed%2520coordinates%250Adoc.add%28button1%252C%250A%257B%250A%2520%2520left%2520%253A%2520200%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D%29%253B%250A%250A%252F%252F%2520Add%2520an%2520event%2520listener%250Abutton1.addListener%28%2522mouseup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Hello%2520Planet!%2522%29%253B%250A%
2520%2520window.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%257D%29%253B%250Abutton1.addListener%28%2522keyup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Hello%2520Mars!%2522%29%253B%250A%2520%2520window.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%257D%29%253B%250A%22%7D
<http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22%252F%252F%2520Create%2520a%2520button%250Avar%2520button1%2520%253D%2520new%2520qx.ui.form.Button%28%2522First%2520Button%2522%252C%2520%2522icon%252F22%252Fapps%252Finternet-web-browser.png%2522%29%253B%250A%250A%252F%252F%2520Document%2520is%2520the%2520application%2520root%250Avar%2520doc%2520%253D%2520this.getRoot%28%29%253B%250A%250A%252F%252F%2520Add%2520button%2520to%2520document%2520at%2520fixed%2520coordinates%250Adoc.add%28button1%252C%250A%257B%250A%2520%2520left%2520%253A%2520200%252C%250A%2520%2520top%2520%2520%253A%252050%250A%257D%29%253B%250A%250A%252F%252F%2520Add%2520an%2520event%2520listener%250Abutton1.addListener%28%2522mouseup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Hello%2520Planet%21%2522%29%253B%250A%2520%2520window.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%257D%29%253B%250Abutton1.addListener%28%2522keyup%2522%252C%2520function%28e%29%2520%257B%250A%2520%2520alert%28%2522Hello%2520Mars%21%2522%29%253B%250A%2520%2520window.open%28%2522%2522%252C%2520%27_blank%27%29%253B%250A%257D%29%253B%250A%22%7D>
On Tue, Dec 22, 2009 at 4:55 AM, Christian Schmidt
<[email protected] <mailto:[email protected]>>
wrote:
Hi Ken,
I think you are talking about a native window and not from the
qx.ui.window.Window, right? I'm not sure, but perhaps there
is an issue
with the focus handler, when you are using the keyboard.
Could you
please provide a short code snippet which reproduce your
issue. And
which qooxdoo version do you use?
Thanks,
Chris
Am 21.12.2009 18:58, schrieb Ken MacDonald:
> I am having difficulty with events on a button. I have a
"Print"
> button, and having a listener attached to the "execute".
Inside the
> listener, I open a window (or tab) to receive a .PDF file. If I
> mouseclick the button, the listener is fired, and
everything works OK,
> the window opens and eventually gets its .PDF.
>
> However, if I TAB to the button and hit the RETURN key, the
same
> listener is fired, BUT the window is blocked by my popup
blocker (IE8
> and FF3.5). If I TAB to the button and hit the SPACE key,
the listener
> is fired and the window appears in FF, but is blocked in IE8.
>
> So, I thought I'd add another listener, for the "keyup"
event, because
> with the 'execute' listener in place, the event doesn't
fire until you
> release the SPACE/RETURN keys. After adding the 2nd
listener, BOTH
> listeners are fired, but the 'execute' listener is fired first.
>
> We read (I think the IE docs) recently that popup blocker
can be
> avoided if the window is opened in response to a
user-initiated event,
> so that if we open the window in the first event handler, (e.g.
> mouseclick => execute handler) it works fine, but if the
execute
> handler is invoked indirectly (by capturing key event, then
firing the
> execute event) it is no longer considered user-initiated
and thus the
> popup blocker fires.
>
> It seems that somewhere in qooxdoo, something must be
catching the key
> event and redirecting it to the 'execute' event before the
event
> listener for my key event is invoked. Is this something
that can be
> avoided? The real problem here is that the popup blocker
stops display
> of the .PDF file; I don't really care if I need to have one
event
> listener or two or more, but customer is quite unhappy
about the popup
> blocker.
> Ken
--
Christian Schmidt
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
[email protected] <mailto:[email protected]>
Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias
Ehrlich, Thomas Gottschlich, Robert Hoffmann, Markus Huhn,
Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app
distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
--
Christian Schmidt
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
[email protected] <mailto:[email protected]>
Amtsgericht Montabaur / HRB 6484 Vorstände: Henning Ahlert, Ralph
Dommermuth, Matthias Ehrlich, Thomas Gottschlich, Robert Hoffmann,
Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution
fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
--
Christian Schmidt
Software Entwickler
1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
[email protected]
Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas
Gottschlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver
Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel