Naming columns and rows in CSS Grid - css

I am aware of the named areas in CSS grid, which is useful but requires you specify both column and row and can not expand after that. However, I need a table with infinite rows. I want to place each row's data to its corresponding column by assigning it to its named column. I've looked up the MDN and other sources but didn't find specific knowledge. Could someone here point out a direction? Thanks.
columnA ColumnB ColumnC
dataA dataB dataC
..... ..... ....
[namedA] [namedB] [namedC]

The CSS Grid specification provides for named grid areas, as you have noted.
It also provides for unnamed grid areas.
However, there is nothing in the Grid specification that allows for named grid tracks (columns/rows).
In fact, there is nothing in CSS in general that allows for targeting columns or rows.
You'll either need to use an explicit grid (allowing for defined positioning of grid areas) or JavaScript.

Related

Starting grid column from half of the column

I am trying to start grid column from half of the very first column.
I tried grid-start-column with different values but it's not working. Basically, it should be like following:
grid-column: 0.5/7
I know this is not the valid code, but just for explanation I write that.
Is it possible to start a column from the half of the column?
Is it possible to start a column from the half of the column?
No. It is not.
Let's say you have a grid container with five columns and want to start spanning from halfway inside the first column (grid-column: 1.5 / 5 ). This won't work because you're not starting at a column line. More technically, the grid-row-* and grid-column-* properties accept only integers as values.
However, there is a simple workaround:
Instead of five columns use 10 columns.
Then start spanning at the third column (grid-column: 3 / 10).
This creates an equivalent layout, which looks the same visually, but with more precise control of the columns.
More details here: Changing div heights using CSS grid

SketchUp: dow to make a hole in a complex component?

I have a big cube made up of many smaller cubes. Theoretically, all surfaces should be paralei/perpendicular, but maybe I didn't alligh something (I can be sure). Also, each layer of my big cube is shifted with respect to the previous one by half of the length of side of the smaller cube. So the odd and the even layers are aligned, but an odd layer isn't alligned to an even layer.
I'd like to make s hole trougout the cube, The hole should intersect surfaces of the smaller cubes.
I've found numerous examples of how to make a hole in one component (using the push/pull tool): 1, 2, 3. However, I haven't found any information on how to deal with such a complex component . How can I make a hole throughout my cube?
The idea of creating a hole is to make a figure in form of the hole (for example, a long cylinder or parallelogram) and use it to create the hole.
After creating the figure, compose it to group (let's name it "hole" group) and move it into place of the hole. Make this group as subgroup of the target group. Then use intersect tool: select "hole" group and call "Intersect Faces / With Context" in context menu. After that it is need to delete unneeded parts in the target group.
Step by step solution:
Create a figure of the hole form, group it and give "hole" name.
Move "hole" into the place of the required hole.
Arrange "hole" as subgroup of the target group.
Intersect "hole" group with Context (i.e. parent group that is our target).
Remove unneeded parts in the target group.
The issue is that every subgroup should be edited separately, and to remove unneeded parts it is need to arrange "hole" into this subgroup and do intersection again.
To create inner surface of the hole we can use copy of the "hole" group as matter. Make copy, paste it in place, rename to "surface", arrange it into target group (if any). Then open "surface" group for edit, select all, call "Intersect Faces / With Model" in context menu. Note that intersection will be done with visible parts of the model only. After that delete unneeded parts in "surface" and optionally explode "surface" group. Use layers and hide/unhide tool to temporary hide interfering parts of the model.

Tkinter Grid Columnspan ignored

Consider the following python script
#!/usr/bin/env python
from Tkinter import Tk, Label
width = SOME_VALUE_HERE
root = Tk()
label1 = Label(root, text='1 columns wide')
label2 = Label(root, text='%i columns wide' % width)
label1.grid()
label2.grid(row=0,column=1,columnspan=width)
root.mainloop()
When I run this, no matter what value is set for 'SOME_VALUE_HERE', both labels take up half the window, regardless of whether or not Grid.columnconfigure is called, or the sticky parameter is used in grid().
Unless I've overlooked something, I would have thought that setting the columnspan would force the second label to be 'SOME_VALUE_HERE' times as wide as the first.
Have I misunderstood how grid works? How would I go about achieving this behavior?
By default, empty grid column are zero width, so you described the following table. Grid geometry manager will by default try to optimize the screen real estate used by your application. It will integrate all the constraint and produce the fittest layout.
+---------------+---------------++++
| 0 | 1 |||| <-- 2,3,4 empty, 0 width
+---------------+---------------++++
| 1 column wide | 4 column wide |
+---------------+---------------++++
To provide strict proportional column width, you have to use the uniform option of columnconfigure. uniform takes an arbitrary value to designate the group of the column that share these proportions, and the weight argument is used to properly handle widget resizing.
label1.grid(row=0, column=0)
label2.grid(row=0,column=1, columnspan=width)
for i in range(width+1):
root.grid_columnconfigure(i, weight=1, uniform="foo")
Note that with only these two labels, you could achieve the same layout by adjusting the width of column 1. Differences will occur still while you populate column 2,3,4...
label2.grid(row=0,column=1) #no columnspan
root.grid_columnconfigure(0, weight=1, uniform="foo")
root.grid_columnconfigure(1, weight=width, uniform="foo")
When you put something in column 1 with a columnspan of two (or more) that means it will be in column 1 and column 2 (etc). However, if there is nothing controlling the width of a column, that column will have a width of zero. You need to force column 2 to have a widtheither by putting something in there, giving it a minsize, or forcing uniform columns.
When I look at your code, I can't guess how wide you think column 2 should be, and neither can the computer.
I had a similar problem only to discover that the elements are limited by the widest widget. We can safely say that Tkinter is configured to make your app uniform in that it should be a regular repeating square/triangular structure. Solution to override default options.
With the Tkinter's automatic optimization in mind, play with the width and height of largest widget (grid box) and relate the other boxes to it proportionally.
Using the above method use columnspan to adjust the width.
Configure the widths by use of columnconfigure()

How to stop Grid, GridRow, GridItem from assigning proportional column widths

In Flex4 we use Grid, GridRow and GridItem to layout the components of our screens. Most screens look OK, but quite a few appear with large amounts of space between the label and field. This mainly happens when we want to have something like the following scenario...
Name [____________]
Age [__]
Gender [_]
Details
[__________________________________________]
[__________________________________________]
[__________________________________________]
|<col 1>|<------------ col 2 ------------->|
|<---------- grid and row width ---------->|
...where the Labels are in the first column, the top three fields are in the second column, and the bottom three fields span across both columns. Above is how we would like it appear, but Flex renders it like this...
Name [____________]
Age [__]
Gender [_]
Details
[__________________________________________]
[__________________________________________]
[__________________________________________]
|<--- col 1 --->|<-------- col 2 --------->|
|<---------- grid and row width ---------->|
We don't have the ability to set individual column widths in each screen as a) there are thousands of screens and b) the labels and components can be internationalised.
I can't quite work out the algorithm they use to assign each column its width, but I think it looks for the widest component in each column and then uses these to assign each column an appropriate proportional width.
All we want is for each column to be as thin as possible so it just contains just its widest component (ignoring those that span of course), and doesn't have any extra whitespace. Does anyone know how to achieve this result?

PlayN: GroupLayer.add( layer) seems to ignore layer's depth attribute

Suppose I have 4 layer, A,B,C,D with layer.depth() of 1, 4, 2, 3.
when I add the those layer to parent, by using groupLayer.add(layer), the index (ala, depth,) of them added seems to ignore the 'depth()' attribute and the result is according only to the order when I add them.
Not sure if it's a implementation bug or I have the wrong usage semantic.
I'm not sure this is your problem but it's definitely mine right now.
I'm pretty certain layer depth only obeys the depth value within a group.
If you nest groups (like for parts of a character), I think the layer(s) in higher level groups will always be drawn above the layer(s) in lower level groups.
I'm running into this issue now when trying to create a puppet-like character with lots of image layers arranged in a group layer hierarchy of body parts.
The torso needs to be at the top of the transformation hierarchy but some layers need to be drawn on top of the torso as well. Currently, I don't think you can do this with a single group layer hierarchy with image layers as children.
GroupLayer.add(layer, depth) has been deprecated. Instead you should use Layer.setDepth.

Resources