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 9155755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:39:07+00:00 2026-06-17T12:39:07+00:00

I am having trouble removing an event listener from tab and toolbarbutton. I have

  • 0

I am having trouble removing an event listener from tab and toolbarbutton.

I have added an eventlistener to a toolbarbutton, then after doing some saving part I can’t remove the listener.

exitButton is a toolbarbutton.

Both methods are in same class. But the first Time exitButton has some different logic on onClick event but when I save my data and call disable() method via globalcommand to remove onClick event listener.

@AfterCompose
public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
    Selectors.wireComponents(view, this, false);
    exitButton.addEventListener("onClick", new EventListener<Event>() {

        public void onEvent(Event evt) throws Exception {
            Messagebox.show("adddingggg");
        }
    });
}

@GlobalCommand
public void disable() {
    exitButton.removeEventListener("onClick", new EventListener<Event>() {

        public void onEvent(Event evt) throws Exception {
            Messagebox.show("remocvee");
        }
    });
}

How can I remove the Event Listener after a save?

  • 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-06-17T12:39:08+00:00Added an answer on June 17, 2026 at 12:39 pm

    Please keep in mind, that your EventListener instance must return true,
    if it is the parameter of Object#equal called for the former added listener.

    EventListener evl;
    
    @AfterCompose
    public void afterCompose(@ContextParam(ContextType.VIEW) Component view) {
        Selectors.wireComponents(view, this, false);
        exitButton.addEventListener("onClick", evl = new EventListener<Event>() {
    
            public void onEvent(Event evt) throws Exception {
                Messagebox.show("adddingggg");
            }
        });
    }
    
    @GlobalCommand
    public void disable() {
        if(exitButton.removeEventListener("onClick", evl))
                Messagebox.show("success");
    }
    

    This will remove the EventListener, and show message if it was successful.
    You problem was that you created a new object so it is not equal to the old one.

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

Sidebar

Related Questions

I am having trouble programmatically removing stacks from a view. I am doing things
I'm having some trouble dynamically removing UITextFields from my scrollview when the user taps
Currently I am having trouble with removing duplicates from a given array. I have
I seem to be having some trouble removing some events from an element using
I’m having trouble removing the an event listener as well as the sprite at
I'm having some trouble removing null values from a 2D array. I'm still a
I'm having some trouble removing an element that gets added dynamically to the DOM.
I am having trouble with hiding/removing the card owner and image from the card
I'm having trouble with adding and then removing an AjaxSelfUpdatingTimerBehavior in Apache Wicket. The
I'm having trouble removing a gem from my system. When i ask gem where

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.