Re: Left-justifying widgets in a GtkTable?




Mark Andrew Hulme-Jones <ceemahj@cee.hw.ac.uk> writes:

> It occurred to me (whilst attempting to do so) that for doing forms design
> of any sort, the current table could be adapted to be an incredibly
> powerful packing tool thing, whilst at the moment it is just plain
> annoying, take the following for example:
> 
> _______________________________________________________
> |Label  | Text Widget | Label 2 | Text Widget 2       |
> -------------------------------------------------------
> |Label 3| Text Widget 3              |                |
> -------------------------------------------------------
> 
> So far as I can tell, this is simply not possible with the current
> GtkTable widget, you have to play around with multiple h/vboxes, and
> setting thousands of horrible usizes... *yawn*
> 
> What seems to be the trouble is that the GtkTable layout thing assumes
> that you want every centered (?) so you end up with the following...
> 
> _____________________________________________________________
> |  Label 1  | Text Widget 1 |    Label 2    | Text Widget 2 |
> -------------------------------------------------------------
> |   Label   |          |      Text Widget 3      |          |
> -------------------------------------------------------------
> 
> This is nowhere near as pretty...
> 
> So, has anyone got any idea whether this is actually possible at the
> moment? Or whether anyone except me thinks it would be worth doing? ;)

It is defininitely posssible. Check out the GtkAlignment widget.

  GtkWidget* gtk_alignment_new        (gfloat             xalign,
				       gfloat             yalign,
				       gfloat             xscale,
				       gfloat             yscale);

  alignment = gtk_alignment_new (0.0, 0.5, 0.0, 0.0);
  gtk_container_add (GTK_ALIGNMENT (alignment), cell_contents);
  gtk_table_attach (GTK_TABLE (table), alignment, ....)
  gtk_widget_show (alignment);

It might be nice to add the that capability directly into GtkTable -
(or at least provide an easy way of creating the adjustment
semi-automatically). The problems is that would mean function with 4
more arguments than gtk_table_attach. One really wants named
parameters in this circumstance...

Regards,
                                        Owen


  



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