Git Product home page Git Product logo

Comments (7)

nagyrobi avatar nagyrobi commented on July 24, 2024 1

Pinging my colleague @clydebarrow

from lvgl.

kisvegabor avatar kisvegabor commented on July 24, 2024

Szia Robi! 🙂

It has no effect because the columns has fr(1) width. Due to this they fill the whole width of the parent and they cannot be aligned at all as there is no space to move them.

You can either

  1. Not fill the whole width:
static const lv_coord_t page_1_column_dsc[] = {150, 150, LV_GRID_TEMPLATE_LAST};
  1. Align the cell in the column:
lv_obj_set_style_grid_cell_x_align(cell_1_1, LV_GRID_ALIGN_CENTER, 0);

image

from lvgl.

nagyrobi avatar nagyrobi commented on July 24, 2024

Szia!

As we understand from the doc, the whole width of the parent should be treated as fr(1) + fr(1), that means, if eg. the parent is 200px wide, the grid columns (thus cells) widths should each result to 100px. So fr(1) + fr(1) is whole width of the parent, a single fr(1) should be half width of parent.

Now if I place smaller children within these cells, I should still be able to commonly set an alignment for them.

So 1. - that's the whole point of fr(xx) stuff, to not specify discrete widths, but calculate them on the run, 2. - individual alignments of course work for each cell, but that defeats the purpose of the single line grid_column_align.

If it's possible to do it with grid_cell_x_align for each cell one by one, common sense implies that grid_column_align should do the same for all the cells. Like a better name for grid_column_x_align would be.

from lvgl.

nagyrobi avatar nagyrobi commented on July 24, 2024

@clydebarrow

from lvgl.

kisvegabor avatar kisvegabor commented on July 24, 2024

Aligning the column and the content are two independent things. Imagine a single 100 px wide column. You can align this column to the left, center or right, and separately set where to place the cells in it.

I understand that having something like justify-items in CSS might make sense in LVGL too. By default the cell's alignment could be auto so the parent's justify-items is applied however it can be overwritten individually in each cell.

from lvgl.

nagyrobi avatar nagyrobi commented on July 24, 2024

Well if you have two 100px columns near each other, filling a total of 200px, their alignment doesn't make sense. They will be in the same position regardless the alignment...

I understand that having something like justify-items in CSS might make sense in LVGL too. By default the cell's alignment could be auto so the parent's justify-items is applied however it can be overwritten individually in each cell.

That would be more intuitive, yes.
Please backport it to v8...

from lvgl.

kisvegabor avatar kisvegabor commented on July 24, 2024

Well if you have two 100px columns near each other, filling a total of 200px, their alignment doesn't make sense. They will be in the same position regardless the alignment...

Yep, that's why I mentioned a single column in my example above.

That would be more intuitive, yes.

Are you interested in contributing with this feature?

from lvgl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.