Re: gtk_dawing_area_size...
- From: John Cupitt <john cupitt ng-london org uk>
- To: Andrés Giraldo <andres_giraldo yahoo com>
- Cc: Gtk List <gtk-list gnome org>
- Subject: Re: gtk_dawing_area_size...
- Date: Wed, 04 Jul 2001 14:04:36 +0100
"Andrés Giraldo" wrote:
> sorry! I didn't expose my question well.
>
> I add a drawing area as a container in a button
>
> gtk_container_add (GTK_CONTAINER (button),
> drawing_area);
>
> Then I connect a expose_event signal to the
> drawing_area, and finally I want to change the drawing
> area size, but I can't.
>
> Maybe can't I work with a button as a container?
No, this should be fine. Something is broken in your program :-)
This code works for me:
--
#include <gtk/gtk.h>
static void
button_clicked( GtkWidget *button, GtkWidget *draw )
{
static int size = 20;
gtk_drawing_area_size( GTK_DRAWING_AREA( draw ), size, size );
size += 20;
}
int
main( int argc, char **argv )
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *draw;
gtk_set_locale();
gtk_init( &argc, &argv );
draw = gtk_drawing_area_new();
button = gtk_button_new();
gtk_container_add( GTK_CONTAINER( button ), draw );
gtk_signal_connect( GTK_OBJECT( button ), "clicked",
GTK_SIGNAL_FUNC( button_clicked ), draw );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_container_add( GTK_CONTAINER( window ), button );
gtk_widget_show_all( window );
gtk_main();
return( 0 );
}
--
The window starts very small ... every time I click the button, it gets
bigger.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]