Added clear and remove methods for handlers#19
Open
Tigerpanzer02 wants to merge 1 commit intoMrMicky-FR:masterfrom
Open
Added clear and remove methods for handlers#19Tigerpanzer02 wants to merge 1 commit intoMrMicky-FR:masterfrom
Tigerpanzer02 wants to merge 1 commit intoMrMicky-FR:masterfrom
Conversation
Owner
|
Hi, wouldn't be easier to add a condition in the [close/click/open] handler to "remove" it when it's not needed ? Like in the example in the README |
Author
|
Can you Show me the Part on the readme, I cant find. |
Owner
|
My bad it’s not directly in the README, but for example you can do this: boolean ignoreClicks = false;
inv.addClickHandler(e -> {
if (ignoreClicks) {
return;
}
if (someConditionThatShouldRemoveHandler) {
ignoreClicks = true;
}
}); |
Author
|
Yep thats possible but if I cold remove all added handlers with Just one Line as the inventory should Close without any Interactions it would be way easier. Also it would be possible to create multiple default handlers which I can add and remove Like I want for the inventory 😅 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In my case it was useful to have a clearCloseHandler (having a default close handler which gets removed after something in gui got accepeted). I just added it for the other handlers in this pr, too. Just in case someone else needs it.
[A different way would be to make the handlers list public / accesable]