Package: gtk

Function gtk:tree-view-insert-column-with-attributes

Lambda List

gtk:tree-view-insert-column-with-attributes (view pos title renderer &rest attributes)

Arguments

view -- a gtk:tree-view widget
pos -- an integer with the position to insert the new column in
title -- a string with the title to set the header to
renderer -- a gtk:cell-renderer object
attributes -- pairs of attribute and colnum
attribute -- a string with the name of a property of renderer
colnum -- an integer with the column in the model with the value for attribute

Return Value

The integer with the number of columns in view after insertion.

Details

Creates a new gtk:tree-view-column object and inserts it into the tree view at pos. If the pos argument is -1, then the newly created column is inserted at the end. The column is initialized with the attributes given. If the tree view has the fixed-height-mode property enabled, then the new column will have its sizing property set to be the :fixed value.

Examples

Insert a new column in a tree view with a cell renderer for displaying text. The text, weight and foreground properties are connected to the column 0, column 5 and column 6 in the model for the tree view.
(let* ((model (create-and-fill-model-simple))
       (view (gtk:tree-view-new-with-model model))
       (renderer (gtk:cell-renderer-text-new)))
  (gtk:tree-view-insert-column-with-attributes view
                                               0
                                               "Title"
                                               renderer
                                               "text" 0
                                               "weight" 5
                                               "foreground" 6)
  ... )    
 

See also

2024-3-13