Nifty: Can I modify Style Effects?

Hey,



I’m trying to define a common style for my panels in nifty-gui. Is it possible for me to give my common style an effect such as:



onStartScreen name=“move” …



and then modify that effect slightly for particular panels so that one could have, for instance, direction=“left” and another have direction=“top”?



I’m hoping I can do something like with the style attributes where you define a common base style, but you can overwrite attributes as needed for a particular element…

Or do I just have to define my effects separately for each element if they are not going to be exactly the same?



Thanks!

-K

I take it from the lack of response that I just have to define each element’s effect separately if I don’t want them all to be exactly the same?

Sorry for the lack of response.

@void256 (creator of nifty) used to lurk the forum, but he is very busy at the moment with nifty developments.



I think that you can use a default style, but override it on any former tag using it like in html. Not completely sure about it but i think i’ve seen it in the jnlp tutorial available here nifty-tutorial



Maybe you can have a look at it.

Thanks,



I’ve been through that tutorial a few times now, but I don’t think it shows any ways to easily modify an effect that has already been defined in a style. I can only see how to modify the style’s attributes.



Maybe I’ll try getting void’s attention on the nifty forums at sourceforge…

This is currently not supported for effects, I’m afraid. You need to create separate styles for this and they cannot inherit from a single base style.



Effect attributes are not merged with base style attributes. Instead they are currently always overwritten.



Edit: Which means that when you add any effect then Nifty currently forgets all of the attributes from any inherited styles and simply uses all the attributes you set. This restriction applies to <effect>. For style <attributes> it should work as expected and the attributes will be merged with any parent style attributes. Please note that you can’t remove attributes, you can only overwrite or add new ones. It would be nice to have the same for <effect>s but it’s currently not supported for effects :confused:

1 Like

Thanks for clearing that up, Void.



And thanks for all the work you’ve done with Nifty. I’ve only just started using it in the last month or so, but now that I am starting to figure it out, I quite like it.

I’ve just noticed that my answer probably didn’t make much sense because the xml tags where missing xD



I’ve fixed that now :slight_smile: and thanks for liking Nifty too :smiley: