Niftygui Console 1.4.1, the ListBox is not scrolling?

[Edit: my last post has the workaround]

At TestNiftyExamples, when I press F1, the 1st time the console opens, I can type many things and hit enter and scroll fine, up and down. I works perfectly.

But, as soon I hit F1 to close it and hit F1 again, the console ListBox is empty (EDIT: I found out that it is actually scrolled to line 0, top line, where it has only about 30 empty lines).
I try to scroll up down and nothing shows up.
I have to go on the textfield and hit enter and the last full page shows up again (EDIT: it actually simply scrolled down to the last line), but now, the scroll stops working, I cant scroll up, the scroll bar moves up but nothing changes on the ListBox.

What can I do? You all have it working properly?

ps.: my guess is may be the problem is on the vertical scroller, I dont really know yet how it works… It seems we can reimplement the xml part of the console and the class will adapt itself to it, as long it has the minimal controls (textfield and listbox) I will see what I can do.

ok, I was debugging Nifty.

I found that the problem is the vertical scroll event is not being listened, because the listeners list is empty.

BrokenStack1 The subscribers (listeners) list related to this exact match subscription topic “console#listBox#scrollpanel#vertical-scrollbar” returns empty.

ThreadSafeEventService.publish(String, Object) line: 920	
Nifty.publishEvent(String, NiftyEvent) line: 306	
ScrollbarControl$ScrollbarViewVertical.valueChanged(float) line: 267	
ScrollbarImpl.changeValue(float) line: 175	
ScrollbarImpl.interactionMove(int) line: 156	
ScrollbarControl.mouseMove(int, int) line: 125	

OkStack2 The first time the console is opened, this is a working v.scroll stack trace:

ListBoxImpl<T>.updateView() line: 69	
ListBoxImpl<T>.updateView(int) line: 64	
ListBoxControl$1.onEvent(String, ScrollbarChangedEvent) line: 81	
ListBoxControl$1.onEvent(String, Object) line: 78	
Nifty$ClassSaveEventTopicSubscriber.onEvent(String, Object) line: 1750	
ThreadSafeEventService.publish(Object, String, Object, List, List, StackTraceElement[]) line: 980	
ThreadSafeEventService.publish(String, Object) line: 920	
Nifty.publishEvent(String, NiftyEvent) line: 306	
ScrollbarControl$ScrollbarViewVertical.valueChanged(float) line: 267	
ScrollbarImpl.changeValue(float) line: 175	
ScrollbarImpl.interactionMove(int) line: 156	
ScrollbarControl.mouseMove(int, int) line: 125	

As you can see, after the publish, the subscriber is found and it runs properly at OkStack2.

What I am not understanding at BrokenStack1 is:

  1. the vert scroll is unsubscribed initially

    Nifty.unsubscribe(String, Object) line: 332
    ListBoxControl.removeVerticalScrollbar() line: 443
    ListBoxControl.initializeScrollPanel() line: 824
    ListBoxControl.init(Parameters) line: 291

  2. but just after it is re-subscribed

    ListBoxControl.subscribeVerticalScrollbar(Element) line: 353
    ListBoxControl.createVerticalScrollbar() line: 409
    ListBoxControl.updateTotalCount(int) line: 533
    ListBoxImpl.updateViewTotalCount() line: 407
    ListBoxControl.init(Parameters) line: 300

  3. how can the BrokenStack1 return an empty list at here?

    ThreadSafeEventService.getSubscribers(Object, Map) line: 1387
    ThreadSafeEventService.getSubscribersToTopic(String) line: 1239
    ThreadSafeEventService.getSubscribers(String) line: 1221
    ThreadSafeEventService.publish(String, Object) line: 920
    Nifty.publishEvent(String, NiftyEvent) line: 306
    ScrollbarControl$ScrollbarViewVertical.valueChanged(float) line: 267
    ScrollbarImpl.changeValue(float) line: 175
    ScrollbarImpl.interactionMove(int) line: 156
    ScrollbarControl.mouseMove(int, int) line: 125

  4. This code is working and the result is an empty list:

    ThreadSafeEventService.getSubscribers(Object, Map) line: 1387
    subscriberMap.get(classOrTopic);

  5. after the console is opened, onEndScreen() is happening, that unsubscribes the v.scroll listener:

    ThreadSafeEventService.unsubscribe(String, EventTopicSubscriber) line: 690
    Nifty$SubscriberRegistry.unsubscribeElement(Screen, String) line: 1937
    Nifty.unsubscribeElement(Screen, String) line: 348
    Element.onEndScreen(Screen) line: 2620
    ElementRemoveAction.perform() line: 33
    EndOfFrameElementAction.perform() line: 22
    Nifty.executeEndOfFrameElementActionsInternal() line: 485
    Nifty.handleDynamicElements() line: 437
    Nifty.update() line: 368
    InputSystemJme.endInput() line: 112
    InputManager.processQueue() line: 843
    InputManager.update(float) line: 907

PS.: I got the sources for eventbus-1.4.jar here, to help on debugging.

Maybe try nifty 1.4.2-SNAPSHOT

1 Like

thx, I found it here:

http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty/1.4.2-SNAPSHOT/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-examples/1.4.2-SNAPSHOT/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-style-black/1.4.2-SNAPSHOT/
http://nifty-gui.sourceforge.net/nifty-maven-repo/lessvoid/nifty-default-controls/1.4.2-SNAPSHOT/

Even the snapshot gave the same problem.

I partially “fixed” it by issuing these commands in this order, one per frame after the frame when the console is opened:

1st - this will remove the vert scroll bar (‘GConsole1’ is the id given at xml file to ‘nifty-console’)

lbc = console.getElement().findNiftyControl("GConsole1#listBox", ListBoxControl.class);
lbc.updateTotalCount(0); 

2nd - this will re-add the vert s.bar (only works if it was removed), and so will also re-subscribe it to events

lbc.updateTotalCount(console.getConsoleContent().length);

3rd - this will scroll to the end and show everything

console.output("console opened!");

PS.: btw the console from Nifty 1.3.3 (JME 3.0) works perfectly all the time.