CList column titles



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


  Hello,

  Yet again I need some help <G>. I've got a clist with 3 columns (track
#, name, length). When the user resizes the window I want the middle
column to resize, leaving the other two (track # and length) at the width
last set by the user. This allows the user to just resize the window to
thow more of a long track name, instead of resizing the window and then
resizing the track name column.

  I actually have this almost working. I've implemented this by catching
the size_allocate signal on the window that contains the CList, and then
resizing the titles using the following code:

void resize_titles( GtkObject  *clist )
{
  int total_width,
      col_width;

  /* Get the widths of the other column titles */
  col_width = GTK_CLIST(clist)->column[0].width +
              GTK_CLIST(clist)->column[2].width;

  /* This almost gives the right width, but not quite...
     The 8 is a kludge to make it look right, if you have a better
     solution, email me!
  */
  total_width = GTK_CLIST(clist)->column_title_area.width -
                GTK_CLIST(clist)->vscrollbar->allocation.width -
                8;

  /* The questions here are:
     x 1. How do I pass clist to this routine?
     x 2. How do I get the width of the clist?
          (sorta)
       3. How do I get the width of each of the column titles, in case
          they have been changed by the user?
          Look at the list I guess
  */

  gtk_clist_set_column_width (GTK_CLIST (clist), 1,
				total_width-col_width);
}


The problem is that the right side of the length column doesn't line up
with the edge of the CList window. It seems to be lining up with the edge
of the scroll bar? So, is there a better way to do this?

Also, how can I catch when a user changes the width of a column and record
that change so it can be used when resizing or stored for the next time
the window is opened?

  Thanks!

  Brian

- ---------------------------------------------------------------------------
Nexus Computing                                http://www.tatoosh.com/nexus
Software & Electronics for Linux                          nexus@tatoosh.com
Inside is a comfortable 73.71 F and Outside is a freezing 36.40 F

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v0.9.0 (GNU/Linux)
Comment: Remember Lexington Green!

iEYEARECAAYFAjaPookACgkQIftj/pcSws3qawCghJ7ed0OQ/pQT4zDTMOYg1Kfn
WBgAnR3afjWALsC68IOs3Y86a1nYw3jM
=XKp3
-----END PGP SIGNATURE-----



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