I don’t understand what this means. Either the question doesn’t make any sense or the answer is “it already does?” So… you will have to be more specific.
I assume you’ve read this?
There are no unique IDs for findElement() or anything like that. You can use whatever JME methods are available for doing this kind of crappy programming. Generally, basing a lookup deep down 1000 children on some name is not a good programming practice.
I haven’t read that, I must admit. I’ve only read the first parts and tried to implement an own element.
What I did was extending Container and then I had elementId’s like Window or Window.titleBar etc which resulted to no style being applied.
So the question should say: When I define a non-existant elementId, Lemur won’t look up the style under the default Element Id? (The reason could be that you can change the style later and it’s defined in there)
So assuming I would keep those Window.titleBar namings, is there an easy way to say, that Window should copy/inherit everything from Container?
And I think I understand your concerns about naming and 1000 children, but when the hiearchy is constant as in an self-written element and the id has to be unique? I thought about it simplifing the access to GUI Components instead of having to keep a java-variable for anything.
Imagine a Script being executed by a Button Call which want’s to change it’s Windows Title.
What default element ID? You’ve wiped it out by specifying your own.
If you want a window title to also inherit from label… then put .label on the end… since it’s still a label.
“window.title.label” for example.
During styling, the GUI elements have no idea what their containment will be so normal CSS approaches don’t work but Lemur does support the same idea of “apply a style to all labels under foo” as long as the element IDs for those start with “foo” and end with “label”.
But I’m pretty sure that is covered in more detail than I can provide here in that link.
What is myWindow? Is it a giraffe? Is it your custom component? If it’s a giraffe or a loaded 747… then obviously calling findElement on it is nonsense. If it’s your own custom Container subclass then myWindow.getTitle() should be fine. Else if it’s just components you’ve named then just manage them better.
By the way, we have been misusing the word component in this conversation because Lemur has a very special idea of what “Component” is. We’ve so far (I think) been talking about GUI elements.
Else, if you want to use name lookups… just use JME’s-already-built-in-support-for-this… ie: just set the name of your Spatial… since all Lemur GUI elements are just Spatials. Then use getChild(“yourName”). There is no good reason for Lemur to add extra anti-pattern on top of the already provided stuff.
Sorry if I seem frustrated… I’m on vacation and typing on the laptop keyboard which makes me want to strange kittens. I hate these things with the burning fury of a thousand suns.
Note: in lieu of actual documentation on creating custom GUI elements… you can take a look at some I’ve done already in Lemur itself (especially Lemur-proto) if you want to see some ideas on how to do it.
The public static final ELEMENT_ID. But yeah I agree, when I set something wrong it’s up to me and could be intentional.
The other things are contained in the link you’ve linked, indeed!
That’s true. I wanted to shift off thinking about a proper interface by simply exposing everything to the user
On the other hand I don’t know if it’s that important for them to access (foreign) gui elements.
Poor Kittens! But seriously enjoy your vacation instead of helping beginners on here
Anyway, I’ve stumbled into new trouble.
I first wanted to increase the alpha-value of special containers using the groovy styles.
Problem: background is null as it’ll be evaluated afterwards (to have the parent value).
So I copied the TbtQuadBackgroundComponent.create stuff from the hub/repo but that lead me to the Problem that TbtQuadBackgroundComponent doesn’t seem to be defined, however setting fontSize and others work.
When I directly import the TbtCompo I get:
Script2.groovy: 1: unable to resolve class com.simsilica.component.TbtQuadBackgroundComponent
@ line 1, column 1.
Unfortunately I have no clue on where to look or what’s going wrong. Might this be related to the fact that my resources folder isn’t inside the src folder?
After compilation it’s build/resources/main/com/simsilica/lemur/style/base/glass-styles.groovy
And: Lemur 1.8.2
Edit: It also happens for the regular QuadBackgroundComponent, maybe the whole component sub-package is missing?
Oh god that’s so embarassing That happens when you focus too much about how many l’s there are (since on some fonts it looks like two l’s) and then forget about the lemur part
The topic derails but do you have a good example for focusing? I’m planing on something like a Window Manager which always keeps track of the currently focused window and such, but I feel it’s already implemented.
Edit: I implemented FocusTarget
Edit2: Is it only implementing FocusTarget and adding a FocusManagerState? What happens with inter-elementary-focussing (i.e Textfield inside a focused Container?)
Edit3: Do you know an easy way to have a container layout be filled into the opposite y direction? I tried a BoxLayout but unfortunately there is no way to manually instanciate an Axis, so I couldn’t try if that even makes sence?