Clicks on WindowBuilder and/or Button accumulate events (focushandler - elementbuffer)

I have differents nifty windows, so when I click in any part on the window, it looks like it is accumulating events, then when I click on button, this ‘event button’ is repeating as many times as I clicked on the window, plus one (this ‘event button’)



for example this window:







as you can watch in the ‘output console’, there is printing (repeating the method) the ‘event 0’, then ‘event1’ and ‘event2’, and so on. You can confirm this in the ‘system time’

the method that get the button click is:



[java]

@NiftyEventSubscriber(id=“overallRefresh”)

public void onRefreshButtonClicked(final String id, final ButtonClickedEvent event) {

updateData();

System.out.println(“EVENT:” + number + " - time:" + System.currentTimeMillis());

number++;

}

[/java]



also, when I’ debbuging I found that the "elementBuffer’’, in the ‘‘focusHandler’’, is increasing each time that I click on the button or the screen.

for example the next image:







so I consider if I clean this ‘arraylist’ maybe the button event won’t repeat as many times as I clicked on ‘button+window’.

does anybody can give me some ideas to fix this??

thank you

Since your window looks like the standard window control I’m very confident that this commit fixed that issue → https://github.com/void256/nifty-gui/commit/71239e7e65720272d98d256257c2c08a381cb618

well… it was made by WindowBuilder, and I updated (nightly included) the jMonkeyEngine and still has the problem, the same happens with my other issue.

do you have any other idea to fix it?? meanwhile, I will write some flags to avoid calling many time the same event, instead of one

Same answers as the other post: this fix is not in jme yet but will be in about a week.

1 Like