TornadoFX TreeView cell factory not being called -


this related my previous question.

i have treeview in center pane of borderpane layout. treeview populated selection of element list in left pane. center view looks this:

class centerview : view() {     override val root = treeview<istoryitem>()     init {         with(root) {             root = treeitem(controller.storyset)              setcellfactory {                 object : storyeditorcell() {                     init {                         system.out.println("creating storyeditorcell")                         ondragdetected = eventhandler {...}                         ondragover= eventhandler {...}                         ondragentered= eventhandler {...}                         ...                     }                 }             }             cellformat { ... }             populate { ... }         }     } } 

the setcellfactory function being called but, reason, init of factory never being called. drag/drop handlers never set , treecell isn't of correct type.

the cell format correct , treeview populated correctly part working right. else needs done cell factory correct?

calling cellformat creates cellfactory, overwrite configuration of custom factory, hence callbacks never attached cell used in treeview.

if manually call setcellfactory must avoid cellformat , instead override updateitem inside of cell configure text , graphic of cell.

i looked @ implementing custom support dnd can combine cellformat dnd without having create custom cell factory, unfortunately don't have time begin endeavor right now. if feel current approach cumbersome, please create issue on github , we'll asap :)

in mean time, remove call cellformat , should :) remember rules overriding updateitem: call super, clear out text/graphic, if !empty , have value, assign text and/or graphic.

also, don't ondragdetected = eventhandler {...}, setondragdetected {...} instead.


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -