Re: GtkTable cells resizing



On Mon, May 14, 2012 at 10:29 PM, James Steward
<jamessteward optusnet com au> wrote:
On 15/05/12 11:56, Tristan Van Berkom wrote:

Are you using GTK+ 3 ?


Still on GTK+ 2.0.


If so, use GtkGrid instead... possibly just that will fix things for you.

Short of that, if I understand correctly, you have a target
state/configuration
of a GtkTable (or GtkGrid), if you construct the table in the target
configuration
from scratch, I take it things work as you want... but dont work properly
after performing some kind of a transformation to reach your target
state...


That's about it.

... perhaps it's worth trying an extra call to gtk_widget_queue_resize()
after modifying your table.



I'm trying that.   I have signals connected thus;

   g_signal_connect(G_OBJECT(p->canvas), "expose-event",
            G_CALLBACK(&plot_expose_event), p);

   g_signal_connect(G_OBJECT(p->canvas), "select-item",
            G_CALLBACK(&plot_select_event), p);

and get the plot_select_event() routine to calculate and set new canvas
sizes with

gtk_plot_canvas_set_size(GTK_PLOT_CANVAS(p->canvas), width, height);

then call gtk_widget_queue_resize(GTK_WIDGET(p->table));

This causes plot_expose_event() to get called, which calls
gtk_plot_canvas_paint(GTK_PLOT_CANVAS(canvas));

But the table rows seem to expand to the largest canvas and don't seem to
take on variable heights.

Feel I've been around and around the mulberry bush on this ;-)


Hard to say whats going on here, I wonder who is responding
to the size requests for these items which are getting drawn.

It seems you connect to a signal to draw on a widget, which
means the content is not the widget, so probably you need
to also connect a signal to override the size request of the
said widget you intend painting onto ?

Perhaps you are using forced size requests to accomplish
this (using gtk_widget_set_size_request() or such), and
have somehow mixed up the size requests while swapping
your content onto new rows/columns ?

Other than that, child 'expand' properties will be considered
by the GtkTable (if all children can expand, then it's quite
possible that after reaching a large window size the content
will be evenly  spread).

Cheers,
        -Tristan

Regards,
James.


On Mon, May 14, 2012 at 9:21 PM, James Steward

<jamessteward optusnet com au>  wrote:


Hi,

I have an application with a tabbed view.  On two tabs I have a table,
one
is a 2x2 table, the other a 3x1 table (3 rows).

In each cell is a canvas that has a gtk plot.

I want to be able to click one of the plots in the 3x1 table and change
the
canvas size to 2/3 the original, with the other two canvases being 1/6
the
original size.

After redrawing and resizing and mucking about, I can't get the table
rows
to be different sizes, accommodating the different sized canvases
properly,
even though I have gtk_table_set_homogeneous (table, FALSE);

Any clues how to do this?

Regards,
James.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list








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