-
Notifications
You must be signed in to change notification settings - Fork 271
[QUESTION] Make own abstract TornadoFX Fragment class with own root #1333
Comments
If you only have a GUI build, why not just create a function, or Create a class inherited from Parent? Or do you want it through Fragment (UICOmponent)? |
Can't follow you. Can you give an example? As I understood you want that my DashboardView provides a method to add new fragments? |
No.
|
Hey, extension function is a good idea. But I don't know why its not working. I've tried it in two ways. First: class DashboardInfoFragment : Fragment() {
override val root = anchorpane {
dashboard {
button("Content")
}
}
} But I get an exception when load the view:
If I remove And when I try to use it this way (which would be my preferred way): override val root = dashboard {
button("Content")
}
} I need to add a return type of parent to the function but to be frank I don't know what I shall return or how. |
I want to avoid duplicate code. I want to implement something like a dashboard. Within this dashboard, I want to involve different small fragments with a title. So in general, every dashboard fragment looks the same, but the content should be different. I tried different approaches but I wasn't able to implement them. Basically what I want to reach is to have a new abstract class that acts the same as a fragment but the root of this fragment is already inside of this new dashboard fragment. The following code snippet will generally explain what I want to reach:
And I want to be able to use it like this:
And what I want to reach is that my label with "My analyzed data" is inside the anchorpane of my DashboardFragment. So that the title label above is always there and is adaptable by its property.
The text was updated successfully, but these errors were encountered: