Re: GtkTreeView and column width measurements



On Wed, Sep 16, 2009 at 2:20 PM, Wesley Smith <wesley hoke gmail com> wrote:
> I'm trying to auto-resize GtkTreeView columns based on the width of
> the GtkTreeView but am not finding any API functions for doing so.  My
> problem is as follows:
>
> - I have 4 columns
> - initial widths are 196 8 8 8
>    The problem here is that I'm basing the width of the first column
> on the view size minus the total width of the last 3 columns.  These
> last 3 columns initially have a width of 8, but when the first row is
> inserted, they become 30 because they adapt the first time any data is
> shown.  Is there a way I can have them start at the proper width, that
> is the width after the first row is inserted?

Sure you can explicitly set the width of the cells you add to your
treeview columns:

http://library.gnome.org/devel/gtk/stable/GtkCellRenderer.html#GtkCellRenderer--width

>
> - next problem is that I want to resize the first column when more or
> less space because available, but I'm not finding any function for
> explicitly setting the width of a column in GtkTreeView,
> GtkTreeViewColumn, or GtkCellRenderer.  Any ideas?
>

For this you should use set expand to TRUE for the renderers you
are adding to that column with gtk_tree_view_column_pack_start():

http://library.gnome.org/devel/gtk/stable/GtkTreeViewColumn.html#gtk-tree-view-column-pack-start

Cheers,
        -Tristan



> thanks,
> wes
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]