<@UCQRGDEB1> Check out this issue for an example o...
# tornadofx
e
@ValV Check out this issue for an example on how to pass parameters: https://github.com/edvin/tornadofx/issues/731
v
I've tried
Copy code
find<CategoryControlFragment>(mapOf(
  CategoryControlFragment::orientation to HORIZONTAL,
  CategoryControlFragment::creation to false
)).openModal()
It does just open new Fragment in a window, but with the default parameters (if they are specified, otherwise throws
tornadofx.DefaultErrorHandler uncaughtException
). I'm sure, that I've mistaken somewhere, but I can't find where.
find
function does not pass parameters from
mapOf
Pardon... I've forgotten
val orientation: Orientation by param()
and
val creation: Boolean by param()
. Now everything works
e
Great 🙂 Normally scopes is the better option, but for this use case I think parameters are fine. Did you find a good way to deal with the layout inside the CategoryControlFragment?
v
Yes, binding both layout's orientation property and fieldset's
labelPosition
to the same class property
Orientation by param()
does the trick for vertical and horizontal, for square set I've put all the buttons into a single field. Problem with flow layout -- that it does not know what I want, it just gladly stretches all the controls inside the window
e
Maybe grid layout would be easier to manipulate?
v
Definitely I need to play around layouts. Flow layout did well for initial idea of flexible fragment with minimum efforts, yet still it requires some tuning. After mastering scopes, I think, it would be easier to manipulate it
e
You could also have a look at miglayout. I used it back in the day (Swing), but I know they have a JavaFX version as well 🙂