Andreas,

I highly recommend that you go through the GTK+ tutorial first.  This will
give you
some basic grounds on how GTK+ works.  Just a few remarks here:

1.  You probably want to use gtk_widget_show_all in your 'main' function,
rather
than just 'gtk_widget_show'.

2.  If I understand you correctly, you are trying to create a button at
runtime
and add it to the window.  If that's the case, then you create and add it
the
usual way.  Then call gtk_widget_show(button) to make it visible.

3.  Clearly, you don't need anything as complicated as

        GtkWidget * window1 = gtk_widget_get_toplevel(GTK_WIDGET(button));
        gtk_widget_queue_draw(lookup_widget(window1, "window1"));

for this task.  If you call it too frequently, the second line above will
make your
CPU usage explode.  Once again, the tutorial will do a good job for you.


Regards,

Nickolai



On 3/10/06, Andreas Kotowicz <[EMAIL PROTECTED]> wrote:
>
> I have a main.c like this:
>
> int
> main (int argc, char *argv[])
> {
>   GtkWidget *window1;
>   window1 = create_window1 ();
>   gtk_widget_show (window1);
>
>   gtk_main ();
>   return 0;
> }
>
> and I have some callbacks in callbacks.c which modify some labels. now I
> want to create a button "clear" which deletes all user inputs and lets
> you start all over. so the simplest thing is probably to reinitialize
> the window and is widgets, right?
>
> unfortunately this doesn't work (in callbacks.c):
>
> void
> on_button4_clicked                     (GtkButton       *button,
>                                         gpointer         user_data)
> {
> GtkWidget * window1 = gtk_widget_get_toplevel(GTK_WIDGET(button));
> gtk_widget_queue_draw(lookup_widget(window1, "window1"));
> }
>
> what am I doing wrong? or are there any better ways of doing this?
> I also tried doing a gtk_main_quit() followed by a gtk_main() but this
> didn't work either.
>
> cheers,
> Andreas
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to