Page 1 of 1

formspec: dropdowns drop down behind lists

Posted: Sun Dec 30, 2018 08:35
by Linuxdirk
In a soon-to-be released mod I create a formspec like so:

Code: Select all

return [[
    size[8,10]
    list[context;input;0,0;1,1;]
    list[current_player;main;0,6;8,4;]
    list[context;signs;0,1.5;8,4;]
    listring[context;input]
    listring[current_player;main]
    dropdown[2,0;6;category;]]..dropdown_list..[[;1]
    ]]
This is a part of a function that does some checking and properly creates dropdown_list as I want it do be, so no big deal here (except formspecs in general look ugly *g*). But during testing I noticed that the dropdown drops down behind the signs list.

Image

As described: The formspec works perfectly as I want it to work, it is only that the dropdown is rendered behind the list slots of the signs list.

It does not matter in which order I place the definitions and if the dropdown is defined first or last.

By simply searching for dropdown in the forums and on GitHub I was not able to find something similar.

Any hints on how to properly display the dropdown?

Re: formspec: dropdowns drop down behind lists

Posted: Sun Dec 30, 2018 09:30
by Pyrollo
This may be a stupid idea but have you tried to change the order of your widgets ? For example, put the dropdown just after size, before everything ?

Re: formspec: dropdowns drop down behind lists

Posted: Sun Dec 30, 2018 09:43
by Linuxdirk
Pyrollo wrote:This may be a stupid idea but have you tried to change the order of your widgets ? For example, put the dropdown just after size, before everything ?
As described I did this, yes. I tried all possible positions, dug the node and placed it again after restarting Minetest.

Re: formspec: dropdowns drop down behind lists

Posted: Sun Dec 30, 2018 10:32
by Krock
It's possible to change the drawing order in the source code, but the problem is that Irrlicht elements and custom implemented formspec GUI elements are mixed.

Irrlicht code: Buttons, dropdown lists, checkboxes, labels and input fields
Minetest code: Images, inventory lists, itemstacks (also as images), tooltips and boxes.

If you want to draw stuff in the most logical way, that would be: boxes, inventory lists, images,
buttons, itemstacks, dropdown lists, tooltips (on top of all).
No problem, right? No, it can't be that easy. The Irrlicht elements are drawn in the order they were registered in the formspec string: gui::IGUIElement::draw();. Good luck interleaving that with the Minetest code.

Re: formspec: dropdowns drop down behind lists

Posted: Sun Dec 30, 2018 18:41
by Linuxdirk
So we have a weird mishmash of Irrlicht code and Minetest code.

The most logical way of drawing stuff would be the order they’s defined in, with dynamic overlays (tooltips, dropdown lists) on top of everything.

But who’s issue is this? Minetest’s because there is no proper implementation of Irrlicht’s GUI elements or Irrlicht’s because it ignores custom GUI elements when rendering the GUI?

Since this likely won’t be solved ever except with ditching formspecs and implement something sane I guess I need to redesign my mod’s formspec :/

Re: formspec: dropdowns drop down behind lists

Posted: Mon Dec 31, 2018 00:24
by runs
Linuxdirk wrote:So we have a weird mishmash of Irrlicht code and Minetest code.

The most logical way of drawing stuff would be the order they’s defined in, with dynamic overlays (tooltips, dropdown lists) on top of everything.

But who’s issue is this? Minetest’s because there is no proper implementation of Irrlicht’s GUI elements or Irrlicht’s because it ignores custom GUI elements when rendering the GUI?

Since this likely won’t be solved ever except with ditching formspecs and implement something sane I guess I need to redesign my mod’s formspec :/
The way is to put a request to Minetest code to change.

Re: formspec: dropdowns drop down behind lists

Posted: Mon Dec 31, 2018 00:59
by Linuxdirk
runs wrote:The way is to put a request to Minetest code to change.
I lean towards this, too because I don’t see why Irrlicht should change because of a single game using a combination of Irrlicht and custom UI elements.

I guess I’ll write something up and create a minimal working example.

Edit: https://github.com/minetest/minetest/issues/8036