Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6331733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:07:34+00:00 2026-05-24T18:07:34+00:00

My question is, what’s the different between event preview and event handler in GWT.

  • 0

My question is, what’s the different between event preview and event handler in GWT.

There is a callback function boolean onEventPreview(Event event) for event preview and a callback function void onBrowserEvent(Event event) as well. They are pretty similar, so what’s the different between them? Especially when should I use the event preview at all when the event handler works perfect?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:07:35+00:00Added an answer on May 24, 2026 at 6:07 pm

    DOM.addEventPreview(EventPreview preview) lets you place an event preview on top of the event stack, which is called before any onBrowserEvent(Event event) is fired. This way you can place some logic before the event firing takes place. You can even prevent the event from firing by returning false. For example below example prevents the browser from reacting to mousemove and mousedown events.(Click and drag an image, browser won’t drag an outline of image)

        DOM.addEventPreview(new EventPreview() {
            @Override
            public boolean onEventPreview(Event event) {
                switch (DOM.eventGetType(event)){
                    case Event.ONMOUSEDOWN:
                    case Event.ONMOUSEMOVE:
                        event.preventDefault();
                } 
                return true;
            }
        });
    

    Just a reminder, adding eventPreviews this way is depreciated. Correct way to do it is to use Event.addNativePreviewHandler(NativePreviewHandler handler)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Question Is there a way to have a method that will always run anytime
Question What is the (non-trivial) difference between the following two x86 instructions? 39 /r
Question Implement a function bool chainable(vector<string> v) , which takes a set of strings
Question: Regarding Eclipse plug-in development, what is the distinction between actions bars vs. menus,
Question I'm creating a service for my app, but there's probably pritty simple thing
Question for the etymology wizards out there: which programming language was the first to
Question: In one of my database, there is a value in a varchar-field: Brokers
Question says it all - is there a class somewhere in Windows Forms that
Question : Is there a service or a system methodology that would allow someone
Question: Is there anyway at all to get an OpenGL context from GLUT? Info:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.