edvin / tornadofx

Lightweight JavaFX Framework for Kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gridpaneConstraints works not correctly

liugangnhm opened this issue · 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

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

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 I will test the code later. for now just turn on the lines in the grid