tornadofx icon indicating copy to clipboard operation
tornadofx copied to clipboard

gridpaneConstraints works not correctly

Open liugangnhm opened this issue 4 years ago • 3 comments

class GridConstrainTestView : View() {
    override val root = gridpane {
        prefHeight = 600.0
        prefWidth = 600.0

        row {

            button("1")
            button("2")
            button("3")
            button("4")
        }

        row {

            button("11111111") {
                gridpaneConstraints {
                    columnSpan = 2
                }
            }
        }
    }
}

the row 2 column 1 works fine, image

but if we add more than 1 columns, gridpaneConstraints works not well

{
    override val root = gridpane {
        prefHeight = 600.0
        prefWidth = 600.0

        row {

            button("1")
            button("2")
            button("3")
            button("4")
        }

        row {

            button("11111111") {
                gridpaneConstraints {
                    columnSpan = 2
                }
            }

            button("22222222222222222") {
                gridpaneConstraints {
                    columnIndex = 2
                    columnSpan = 2
                }
            }
        }
    }
}

image

liugangnhm avatar Feb 24 '21 06:02 liugangnhm

you add the button to the second column (in order), you also need to specify in which column to install the button

SchweinchenFuntik avatar Mar 03 '21 18:03 SchweinchenFuntik

you add the button to the second column (in order), you also need to specify in which column to install the button

i had added columnIndex = 2 and it did not work

liugangnhm avatar Mar 08 '21 16:03 liugangnhm

@liugangnhm I will test the code later. for now just turn on the lines in the grid

SchweinchenFuntik avatar Mar 08 '21 18:03 SchweinchenFuntik