Open kovbe11 opened 4 years ago
@edvin can you point me to the right direction please?
I added these two functions, is this the right way? It works, but I'm not sure it won't cause any issues.
fun EventTarget.draggabletabpane(op: DraggableTabPane.() -> Unit = {}) = DraggableTabPane().attachTo(this, op)
fun DraggableTabPane.draggabletab(text: String? = null, tag: Any? = null, op: Tab.() -> Unit = {}): DraggableTab {
val tab = DraggableTab(text)
tab.tag = tag
tabs.add(tab)
return tab.also(op)
}
You can have a look at how we create these in the framework itself, look at the hbox() builder for a simple example :)
I'm new to TornadoFX and to Kotlin too, familiar with JFX mostly. Sorry if I missed the answer in your documentation or if this is a rather weird use case of TornadoFX. I'm developing my first TornadoFX app, and it's my first Kotlin project too, and I'd like to do it right.
I have this bit of code here:
As you could guess, this is supposed implement a Tab class that is draggable between other TabPanes.
I'd like to use this something like this:
In short, I'd like to reimplement intellij's "split vertically" feature in TornadoFX. Obviously I could copy paste the code needed to make a tab and a tabpane draggable into the dsl's panes but that seems like the worst solution ever.
How could I make this happen? If you have any suggestions like you already have an implementation for this problem that I haven't found or I could do this better without extending the dsl I'd be happy as well.
Also, I'm not sure my draggable implementation is a good implementation, that's basically a copy-pasted java code from stackoverflow rewritten in kotlin with the minimal code it managed to work with. If you could do that much better please let me know.
Thanks!