Hey …
first i wanted to create a topic but now i feel like 4 topics would be too much so i just send you this PM.
- Screen.java:1265 We made a button with several labels and a geometry on it and sometimes 1 label but always the geometry propagate the mouseOver correctly to the button. On the other labels the button is inactive and not clickable. Larger labels means less area to click
We’ve been doing some investigation – turns out the propagation of events is not okay. Have some code:
It currently works for our usecase (onMouseMotionEvent). But it has to be enhanced for other listeners (onKeyEvent, onMouseButtonEvent, onTouchEvent, onJoyButtonEvent, onJoyAxisEvent).
-
Screen.java:915 the TAB keyEvent is catched but not sent forward to child-elements, this had the effect that my previously working autocomplete (enhanced the onKeyEvent method) on a Textfield didn’t work anymore because it didn’t receive the onKeyEvent(TAB-key).
-
Element.java:420 i don’t know this is the root-cause or the way you draw something/reposition elements but when we add childs with addChild to a scrollarea and resize the window (where the scrollarea is inside) the added childs go crazy in vertical position. When we add childs via JME-way attachChild they are correctly pinned to the parent. Must be something with ScrollArea as the TabPanel in the screenshot seems to be unaffected.
- minor issue but https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:contributions:tonegodgui:evkeyboard says Kayboard… should be Keyboard >.<
Greetings and thanks so far for your work! 
Ok… lets see if I can get through these.
For issue 1: Are you setting Label.setIgnoreMouse(true)?
For issue 2: I need to look into this further.
For issue 3: This is likely due to the default docking. Trying playing with Element.setDocking(Docking docking); to see if this is corrected for you. I’m thinking Docking.NW should stop it from moving on resize.
For issue 4: I’ll get this changed, but again, I seem to have lost edit privileges for the Wiki.
I may have some questions for you about issue 2… I’ll keep you posted. Also, do let me know if any of the suggestions above fix the other issues you are seeing.
For 1: Seems to be working aswell. Though it feels kinda weird to tell every child to ignore mouse.
For 3: Changing Docking.NW or other directions don’t seem to work … still behaves as in the screenshots.
-> Scale the window and the added content in the ScrollArea behaves weird.
@h1ghst0r3y said:
For 1: Seems to be working aswell. Though it feels kinda weird to tell every child to ignore mouse.
For 3: Changing Docking.NW or other directions don’t seem to work … still behaves as in the screenshots.
-> Scale the window and the added content in the ScrollArea behaves weird.
3: I’ve seen this before and I have a feeling that it is a UID issue. Can you verify that the ID of the element is unique? Are you using UIDUtil.getUID() to generate the IDs or naming them yourself? Somehow, under certain circumstances, it seems that duplicate IDs are able to make it past the check in place to ensure this doesn’t happen. Or, as far as I can figure. Can you show me how you are generating the elements being added to the scroll area?
As for 1, I agree… I’ll see about adding this as a default for controls like label, where the mouse interaction would be the odd case. This way, if you choose to use a label in this manor, you would call setIgnoreMouse(false).
In the mean time, I would just set up a method for creating labels that configures them so you don’t have to do this each time.
For 3:
The ScrollArea is initialized in a way that UIDUtils is called:
[java]
inventoryScrollArea = new ScrollAreaAdapter(screen, new Vector2f(), dimensions);
[/java]
The button itself is kindof special, only has 1 constructor:
[java]
ItemFrame item = new ItemFrame(screen, i.getCount(), i.getItem(), pos, getMaterial());
inventoryScrollArea.addScrollableChild(item);
…
public class ItemFrame extends Button{
public ItemFrame(Screen screen, ..., Vector2f position, Material mat)
{
super(screen, UIDUtil.getUID(), position, new Vector2f(500, 50), new Vector4f(25, 25, 25, 25), "tonegod/gui/style/def/Window/panel_x.png");
…
Label nameLabel = new Label(screen, new Vector2f(labelOffset, 2), new Vector2f(400, 20));
…
}
[/java]
Labels also use UIDUtil … nothing fancy.
Just to clarify the issue, it is the label that is going weird on you when you resize, correct? The button stays in the proper place?
Yep… just looked at the screen shot again. Ok… I know I have seen this before and for the life of me, I can’t remember what the issue was, so… time for me to go back and search for the test project I figured this out in and find the solution for you.
In the meantime, try setting the labels with the following:
[java]
Label.setScaleNS(false);
Label.setScaleEW(false);
[/java]
You can also try setting the Docking on the Label to Docking.NW or Docking.SW in case that is effecting it.
I’ve made another screenshot, also added the setScaleNS/EW + setDocking(NW) to both button and labels:

Still both do move when i rescale the window. 
2 new bugs
- When a SelectList has no items and you call selectList.getWidth() than not the real panel-width is returned but a calculated width without the scrollBar-width even though the panel is optical wider.
Without items: http://i.imgur.com/b42UmlO.png
With items: http://i.imgur.com/Lx6dFWj.png
The positioning of the other 2 panels relies on the selectList.getWidth(); the width gets smaller without items so the panels overlap into the selectList.
- The 3 panels from 5. are all added to one Panel for easy positioning. The panels wont be movable later on but for now i noticed i can move the panels and their parent panel. When moving it outside of the Inventory-Panel only the parent-panel gets correct clipping while the 3 child-panels are clipping over like they don’t get any clipping at all.

Any updates on the other issues? Do you need additional information?
@h1ghst0r3y
Sorry for the delay on this (and everything else as of late).
Try and bare with me for a bit here. I have 2 more surgeries coming up, one on the 28th and then another 3 weeks after and am pretty icky atm.
I’ll see about looking at the list of todo’s this weekend as I’m feeling up for it and let you know the results.
Take your time, just had a surgery aswell so i guess i know how your timeschedule mixes up.
Get well soon! 
1 Like
@h1ghst0r3y said:
Take your time, just had a surgery aswell so i guess i know how your timeschedule mixes up.
Get well soon! 
Feeling a bit better today and will be going over this and seeing if I can either a) repo the issue and let you know how to avoid it b) track down any library specific issue and commit a fix c) both 
@h1ghst0r3y said:
Take your time, just had a surgery aswell so i guess i know how your timeschedule mixes up.
Get well soon! 
Can I get an exact list of the nested controls you are using and the order they are in so I can repo this?
@t0neg0d
-
& 6.
[java]
int width = (app.getCamera().getWidth());
int height = (app.getCamera().getHeight());
int sizeX = 1200;
int sizeY = 700;
window = new Window(screen, name + ":window", new Vector2f(width / 2 - sizeX / 2, height / 2 - sizeY / 2), new Vector2f(sizeX, sizeY));
…
TabControl tabControl = new TabControl(screen, new Vector2f(0, titleHeight), window.getDimensions().subtract(0, titleHeight));
tabControl.addTab("Player");
tabControl.addTabChild(0, getPlayerTabContent(screen));
window.addChild(tabControl);
…
private Element getPlayerTabContent(Screen screen)
{
Panel playerPanel = new Panel(screen, new Vector2f(0, 10), new Vector2f(window.getWidth(), window.getHeight() - 70));
Panel playerSubPanel = new Panel(screen, new Vector2f(0, 10), new Vector2f(window.getWidth(), window.getHeight() - 70));
playerPanel.addChild(playerSubPanel);
return playerPanel;
}
[/java]
That should be it. 
Both panels are moveable within the window, but only playerPanel is clipped correctly.
Also i may want to mention that TabControl needs more utility like set/getSelectedTab() or onTabChanged() but i guess for now it’s just an early draft or something.
@h1ghst0r3y said:
@t0neg0d
[java]
int width = (app.getCamera().getWidth());
int height = (app.getCamera().getHeight());
int sizeX = 1200;
int sizeY = 700;
window = new Window(screen, name + ":window", new Vector2f(width / 2 - sizeX / 2, height / 2 - sizeY / 2), new Vector2f(sizeX, sizeY));
…
TabControl tabControl = new TabControl(screen, new Vector2f(0, titleHeight), window.getDimensions().subtract(0, titleHeight));
tabControl.addTab("Player");
tabControl.addTabChild(0, getPlayerTabContent(screen));
window.addChild(tabControl);
…
private Element getPlayerTabContent(Screen screen)
{
Panel playerPanel = new Panel(screen, new Vector2f(0, 10), new Vector2f(window.getWidth(), window.getHeight() - 70));
Panel playerSubPanel = new Panel(screen, new Vector2f(0, 10), new Vector2f(window.getWidth(), window.getHeight() - 70));
playerPanel.addChild(playerSubPanel);
return playerPanel;
}
[/java]
That should be it. 
Both panels are moveable within the window, but only playerPanel is clipped correctly.
Also i may want to mention that TabControl needs more utility like set/getSelectedTab() or onTabChanged() but i guess for now it’s just an early draft or something.
Which panel has the button in it?
Are there Label(s) added to the button?
As for the clipping, I believe that you’ll need to directly set the clipping layer of the nested Panel to the element that the parent panel is added to. As it stands now, the child Panel is using the parent Panel as it’s clipping layer, which would keep it from clipping properly. This may be handled properly if they are added in a different order, but to be on the safe side, I would use .setClippingLayer(WhateverElement);
EDIT: Though, there is the possibility that this will not have the desired effect also. Since this is a very specific use case, you may need to override hook methods to adjust the clipping to a combination of the layers involved. Basically the max of the North and East values of the two parent layers (or more) and the min of the South and West values.
EDIT 2: Also note the y axis is flipped so North may be South, etc, etc.
@t0neg0d
We should keep referencing the bug-number for … easy referencing.
I thought you meant 5. & 6. …
Here’s the example for 3.
Window and TabControl are the same, just the method getPlayerTabContent changes as follows:
[java]
private Element getPlayerTabContent(Screen screen)
{
Vector2f dimensions = new Vector2f(window.getDimensions().x - 5, window.getDimensions().y - 60);
ScrollAreaAdapter playerPanel = new ScrollAreaAdapter(screen, new Vector2f(), dimensions);
Button button = new ButtonAdapter(screen, new Vector2f(100, 100));
Label label1 = new Label(screen, new Vector2f(0, 0), new Vector2f(200, 20));
label1.setText("test1");
button.addChild(label1);
Label label2 = new Label(screen, new Vector2f(0, 0), new Vector2f(200, 20));
label2.setText("test2");
button.attachChild(label2);
playerPanel.addScrollableChild(button);
return playerPanel;
}
[/java]
Now resizing the window will move button and label1 while label2 will stay put on the button.
1 Like
@h1ghst0r3y said:
@t0neg0d
We should keep referencing the bug-number for … easy referencing.
I thought you meant 5. & 6. …
Here’s the example for 3.
Window and TabControl are the same, just the method getPlayerTabContent changes as follows:
[java]
private Element getPlayerTabContent(Screen screen)
{
Vector2f dimensions = new Vector2f(window.getDimensions().x - 5, window.getDimensions().y - 60);
ScrollAreaAdapter playerPanel = new ScrollAreaAdapter(screen, new Vector2f(), dimensions);
Button button = new ButtonAdapter(screen, new Vector2f(100, 100));
Label label1 = new Label(screen, new Vector2f(0, 0), new Vector2f(200, 20));
label1.setText("test1");
button.addChild(label1);
Label label2 = new Label(screen, new Vector2f(0, 0), new Vector2f(200, 20));
label2.setText("test2");
button.attachChild(label2);
playerPanel.addScrollableChild(button);
return playerPanel;
}
[/java]
Now resizing the window will move button and label1 while label2 will stay put on the button.
Perfect! This gives me just what I need to set up a test case to work with! Thank you 
Ok… so far it is looking like the ScrollAreaAdapter may be setting the docking incorrectly for the scrollable area.
Try:
[java]
ScrollAreaAdapter.getScrollableArea().setDocking(Element.Docking.SW);
[/java]
For the Labels on the buttons, try:
[java]
Label.setDocking(Element.Docking.SW);
[/java]
All seems to stay in the proper place this way.
Next, I need to check to see if the TabControl uses a scroll area already. This all may be happening due to a scrollarea being nested in another scrollarea… which was never really planned for.
Actually, ignore the scroll area thing. This seems to be fine already.
Just make sure you add the Labels to the button via addChild and set the Docking to SW
Clipping issues can be resolved by adding the elements in the proper order:
[java]
button.addChild(label1);
button.addChild(label2);
scrollArea.addScrollableChild(button);
tabControl.addTabChild(0, scrollArea);
Window.addChild(tabControl);
[/java]
if you add scrollable children at a later time, make sure you set the clipping layer to the scroll area after you call addChild. Though, this may already be checked for and resolved for the element being added. The issue is, children element of the element you are adding. If they are not added before you call addScrollableChild, you will manually have to adjust their clipping layer.