Hi All,
I’ve used the Nifty Hint effect a few times (http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Effects#hint_.28Nifty_1.3.29) and it works well but I need to make the text inside the popup dynamic and I can’t see any easy way to do that. I need the text to be generated each time the popup appears, ideally I’d then be able to update it after as well although I can live without that.
Something might be possible with a custom control but I was wondering if anyone had any suggestions on the best way to do this?
Thanks,
Z
I think the answer I gave some time ago would work quite well for changing the hint text prior of displaying it: http://hub.jmonkeyengine.org/groups/gui/forum/topic/get-reference-to-hint-control/#post-174201
Changing the text after the hint is being displayed would probably not work right now since the Hint effect will dynamically add a layer to display the hint. And the layerId for this layer is dynamically created and not exposed right now
Thanks, I’ll give that a try tomorrow. I’d like to be able to update (it will be showing the current value of a bar when you hover over it so ideally it would update as the bar changes) but this should still help a lot.
You can always use the current hint effect as the base for your own effect and basically do whatever you want in your own copy The effect is not that complicated.
I agree that the “change the hint text while the hint is displayed”-feature would be nice to have in the build-in effect as well…
@zarch
You got that working?
So far I’ve managed to dynamically add an Hint but nothing is showing up when hovered above. There’s no error or warning so I imagine this should work. But, as it’s been mentioned in that linked thread, maybe this can’t be done.
As far as I could understand this should probably work. But, I might have misunderstood something.
[java]
private void addHintToDraggable(ImageBuilder image, String text) {
HoverEffectBuilder hint = new HoverEffectBuilder(“hint”);
hint.getAttributes().setAttribute(“hintDelay”, “100”);
hint.getAttributes().setAttribute(“hintText”, text);
image.onHoverEffect(hint);
}
[/java]
I am away from computer for a weekend. Can reply in detail next week, but no I didn’t get it working. I’ve rolled my own replacement for the whole nifty popup system but no hover hints yet.