Tutorial (was: Re: Question about widgets)



Hello,
The tutorial looks interesting. But I notice that it is for GTK1.2 and is 
dated February 2000. How useful is it now?

ÃJohn

On Mon, 6 Jan 2003, Tristan Van Berkom wrote:

GtkWidget *button;

is a pointer

GtkWidget button;

would be an `automatic' declaration
of the GtkWidget data structure.

a widget is created by the GObject/GType
system with a function like:

gtk_button_new();

which will return the address of
a newly allocated and initialized
widget.



  It has an interesting thing which is, it has a single widget 'button'
assigned to 2 different button instances "Button 1" and "Button 2". How
is this possible? Is it possible to assign a single widget for multiple
different buttons of the same characterstics?

No. there are two widgets in this picture; only
one pointer was automaticly allocated to point 
to either of them.


Cheers,
                      -Tristan




int main( int   argc,char *argv[] )
{
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;





Vikram S Bartakke wrote:

Hi All,

 Following is a small upgraded hallo window program from the tutorial
site at http://www.gtk.org/tutorial1.2/gtk_tut-3.html#ss3.3

  It has an interesting thing which is, it has a single widget 'button'
assigned to 2 different button instances "Button 1" and "Button 2". How
is this possible? Is it possible to assign a single widget for multiple
different buttons of the same characterstics?

I would be glad if anybody can provide me the answer.

thanks in advance,

code is below:-
==============

int main( int   argc,char *argv[] )
{
    GtkWidget *window;
    GtkWidget *button;
    GtkWidget *box1;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);
    gtk_container_set_border_width (GTK_CONTAINER (window), 10);

    box1 = gtk_hbox_new(FALSE, 0);
    gtk_container_add (GTK_CONTAINER (window), box1);

    button = gtk_button_new_with_label ("Button 1");
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                   GTK_SIGNAL_FUNC (callback), (gpointer) "button 1");
    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
    gtk_widget_show(button);

    button = gtk_button_new_with_label ("Button 2");
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                   GTK_SIGNAL_FUNC (callback), (gpointer) "button 2");
    gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);
    gtk_widget_show(button);

    gtk_widget_show(box1);
    gtk_widget_show (window);

    gtk_main ();
    return(0);
}

========================================
Vikram S Bartakke
Grad Student (CS Dept)
University of New Mexico
Albuquerque, NM 87131
========================================
_______________________________________________
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


-- 
Computers to Help People, Inc.
http://www.chpi.org
825 East Johnson; Madison, WI 53703





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