Data alignment in a GtkTreeViewColumn



I'm having problems with data alignment in a tree view column in
gtk-2.4.  I can get the data right aligned by either setting the xalign
property on the tree column (and using a column in the model to set the
alignment to 1.0) or directly setting the xalign property on the cell
renderer to the value 1.0.  Either way the column comes out looking like
this:

+---------+
|    Value|
+---------+
|     x.xx|
|   xxx.xx|
|xx,xxx.xx|
+---------+

All good so far.  My problem is that when I resize the column, the data
now looks like this:

+----------------+
|           Value|
+----------------+
|     x.xx       |
|   xxx.xx       |
|xx,xxx.xx       |
+----------------+

The column label is still correctly right aligned, but the data is no
longer right aligned.  Its appears to still aligned based upon the
earlier size of the column.  (Or maybe based on the maximum sized data
string displayed.)  I've tried catching the "size-allocate" signal from
the view, finding the new column width, and setting the width property
on the cell renderer.  I've tried catching that signal and calling 
gtk_cell_renderer_set_fixed_size() on the renderer.  Neither has any
effect on where the data is placed in the column.

Interestingly enough, using gtk_cell_renderer_set_fixed_size() at the
time the renderer is created will give me a very very wide column with
the data right aligned.  Using this function from a callback seems to
have no effect.

Does anyone know if getting the data to be right aligned in a resized
column is possible?  I'd appreciate any pointers.

David





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