Set grid template to establish rows instead of columns, and ability to set custom proportions on grid Model

Hi there,

So I'm trying to make a new layout following the grid model for that I already achieved most of what I wanted by following the methodology below

Layout desired

    +----++----++----++----++----++----++----++----++----++----+
    |KNOB||    ||    ||    ||    ||    ||    ||    ||BTN ||..  |
    +----++----++----++----++----++----++----++----++----++----+
    +----++----++----++----++----++----++----++----+            
    |LED ||... ||    ||    ||    ||    ||    ||    |            
    +----++----++----++----++----++----++----++----+            
    +----++----++----++----++----++----++----++----++----++----+
    |KNOB||    ||    ||    ||    ||    ||    ||    ||BTN ||..  |
    +----++----++----++----++----++----++----++----++----++----+
    +----++----++----++----++----++----++----++----+            
    |LED ||... ||    ||    ||    ||    ||    ||    |            
    +----++----++----++----++----++----++----++----+            

        [.....]

For that I have created a "wrapper" (panel/tab) which have the following properties

(...)
        "type": "tab",
(...)
        "layout": "grid",
        "justify": "start",
        "gridTemplate": 10,
(...)

So All the document follow that layout, and is working nice
The LED's row would be a panel spanning 8 columns , containing the 8 LED widgets

            "css": ":host {\n  grid-column: span 8;\n}",

Also the first Knob below each LED panel has to start at column 1, so

            "css": ":host {\n grid-column-start: 1;\n}",

So far so good :slight_smile:
Now I'm getting into the complexity of refining this layout altering the relative size of the KNOB columns and led columns , LED columns , LED's have to be way smaller such as

    +----++----++----++----++----++----++----++----++----++----+
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |KNOB||..  ||    ||    ||    ||    ||    ||    ||BTN ||..  |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    +----++----++----++----++----++----++----++----++----++----+
    +----++----++----++----++----++----++----++----+            
    |LED ||... ||    ||    ||    ||    ||    ||    |            
    +----++----++----++----++----++----++----++----+            
    +----++----++----++----++----++----++----++----++----++----+
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |KNOB||..  ||    ||    ||    ||    ||    ||    ||BTN ||..  |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    |    ||    ||    ||    ||    ||    ||    ||    ||    ||    |
    +----++----++----++----++----++----++----++----++----++----+
    +----++----++----++----++----++----++----++----+            
    |LED ||... ||    ||    ||    ||    ||    ||    |            
    +----++----++----++----++----++----++----++----+            

The issue is that I am a bit confused on how to do this , in normal CSS I would lay the first wrapper in a grid model vertically giving each row a different percentage

.wrapper{
    display: grid;
    grid-template-rows: 45% 5% 45% 5%;
}

(I would have to redefine a little bit the whole css) , but that would be the first step.
The issue is when issue open-stage-control built in's properties, there doesn't seem to be something like selecting the grid-template-row , instead it looks as if once selected "layout" = "grid" the property gridTemplate int number just acts as grid-template-columns: repeat(int, auto) when I really want to do is alter the grid-template-rows.
Therefore I try to embed some CSS in the wrapper container such as

:host{
  display: grid;
  grid-template-rows: repeat(10, auto);
}

But it doesn't have quite the same effect

Anyone know what I may be missing ?

Thank you

It's the inner element you should target, not :host.

1 Like

@freddieventura Is there any chance you would share your session so we could all learn from you?

1 Like

Hey thanks , I have been busy yesterday , I'm gonna try what Jean-Emmanuel mentioned before , I'm still wrapping my head around referring to certain elements with CSS combinators and the classes and html tags generated by open-stage-control , I will be back here if I'm still stuck. Thanks!

I forgot to mention the easiest way is still to use the gridTemplate property which sets the corresponding css property. For example this value in gridTemplate

repeat(10, auto) / auto

is equivalent to this in css

inner {
  grid-template-rows: repeat(10, auto);
  grid-template-columns: auto;
}
1 Like

I get the logic but I don't get the same effect.
I bet we are missing the bit of CSS which is

.wrapper {
   display: grid;
}

virtual-launchcontrolxl-3-grid.json (133.3 KB)

You can take a look to this device (still need to be laid out, but its quite ready functionally) , so in the example of the "wrapper" parent in this case will be

        "type": "tab",
        "id": "virtual-launchcontrolxl",

On there in the CSS at the moment is

        "css": ".button-container,.led-container {
   border-radius: 2rem;
   --line-width: 0rem;
   --alpha-stroke: 0.5;
   --widget-padding: 0rem;
}
> inner > .button-container inner {
    background: radial-gradient(circle, rgba(255,255,255, 0.2), transparent);
}
:host{  font-size: 120%
}",

Omiting that above I want to embed instead of the open-stage-control syntax

        "layout": "grid",
        "justify": "start",
        "gridTemplate": 10,

I want to add then to the css the following lines (as you told me

inner {
  grid-template-rows: repeat(10, auto);
  grid-template-columns: auto;
}

And that is not working at all , even if I put it the firstone in that embeded code of CSS or the lastone selector.
If you could show that , would be great.

What I reckon it may be a thing of having to set up display: grid; on the parent of the element, but I'm not able to actually do that.

Any ideas?
Thanks

There really nothing special to do, just set the "layout" property to "grid", and use the "gridTemplate" property, it sets both css properties "grid-template-rows" and "grid-template-columns" automatically as said in my last post. Only use css if you want to affect other css properties. If you really want to set one of these css property manually via css, you'll need to add !important to override the widget's settings.

1 Like

Im getting advantages , still I couldn't figure out a thing

Would you be able to actually make those buttons span the whole width of the panel with pure CSS?
The embedded CSS is atm (for the panel Widget of top-row)

        "type": "panel",
        "id": "top-row",
        "css": ":host { \n   grid-column : span 9;\n}\n> inner {\n   display: grid;\n   grid-template: 0.5fr 0.5fr 1fr 3fr 1fr 1fr 0.5fr 0.5fr/ 8fr;\n\n}",

messing-panels.json (32.4 KB)

Thank you

Why don't you set that container's layout to grid and use the the gridTemplate property ? It's designed to that effect and works: grid.json (10.3 KB)

1 Like