You mainly use them to display popups like for example a drop down menu or a position entry popup. You connect the custom_popup_edited signal, then in the signal handling function you can use get_edited() to check which TreeItem was clicked and get_custom_popup_rect() to position the popup that you want to display.
Note that the cell itself needs to be set as editable item.set_editable(0, true) before the tree could emit custom_popup_edited signal.
To use the custom mode you have to switch the column of the TreeItem to CELL_MODE_CUSTOM mode and provide a custom render callback by calling set_custom_draw for every TreeItem
var tree = Tree.new()
var item = tree.create_item()
item.set_cell_mode(0, CELL_MODE_CUSTOM)
item.set_custom_draw(0, callbackHolder, "customDraw")
# this method must be in the callbackHolder
func customDraw(item, rect):
tree.draw_rect(rect, Color.new(1,1,1)) # draws your color as cell's background
In this method you may use drawing methods from this tutorial.
It is important to call the draw_something method on the Tree object, not on the callback holder itself. Any Godot’s object may be used as a callbackHolder.