Transparent objects & event handling

0 views
Skip to first unread message

David Given

unread,
Mar 30, 2008, 11:33:02 AM3/30/08
to Google Web Toolkit
I have a transparent object at a high Z-level in my UI. When the user
clicks on it, I want the object *underneath* it to receive the event ---
the transparent object should not consume any events.

Unfortunately I can't figure out how to do this. No matter what I try,
the transparent object consumes the event and the object underneath does
not receive it.

What am I missing?

--
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "I have always wished for my computer to be as easy to use as my
│ telephone; my wish has come true because I can no longer figure out
│ how to use my telephone." --- Bjarne Stroustrup

signature.asc

Ian Bambury

unread,
Mar 30, 2008, 11:39:07 AM3/30/08
to Google-We...@googlegroups.com
What am I missing?
 
That a transparent object with a high z-order that does not consume events might just as well not be there? You can't see it, and it does nothing.
 
Ian

 

David Given

unread,
Mar 30, 2008, 12:30:49 PM3/30/08
to Google-We...@googlegroups.com
Ian Bambury wrote:
[...]

> That a transparent object with a high z-order that does not consume events
> might just as well not be there? You can't see it, and it does nothing.

Yes, very clever...

It's only *partially* transparent. That is, it contains some visual
elements, but I want them to be completely non-interactive and have all
events tunnel through to the object underneath it.

What it's actually for is to draw overlays on on top of my real UI.

signature.asc

Ian Bambury

unread,
Mar 30, 2008, 1:00:19 PM3/30/08
to Google-We...@googlegroups.com
OK, well if it isn't completely transparent, then subclass whatever it is and override the onBrowserEvent method like this
 
    public void onBrowserEvent(Event event)
    {
        super.onBrowserEvent(event);
    }
 
Ian

David Given

unread,
Mar 30, 2008, 2:21:31 PM3/30/08
to Google-We...@googlegroups.com
Ian Bambury wrote:
> OK, well if it isn't completely transparent, then subclass whatever it is
> and override the onBrowserEvent method like this
>
> public void onBrowserEvent(Event event)
> {
> super.onBrowserEvent(event);
> }

Surely subclassing something and adding a method that just calls the
superclass is going to be a noop, though?

signature.asc

Ian Bambury

unread,
Mar 30, 2008, 4:39:15 PM3/30/08
to Google-We...@googlegroups.com
Sorry, brain's gone into meltdown. You are of course correct. I've been pasting and cutting the wrong thing.
 
What is this object you are using?
 
Could you use a popup panel and override it eating events or something like that?
 
public boolean onEventPreview(Event event) {
       return true;
   }
 
Ian
 

 
On 30/03/2008, David Given <d...@cowlark.com> wrote:
Reply all
Reply to author
Forward
0 new messages