[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Question about widgets
- From: Tristan Van Berkom <vantr touchtunes com>
- To: Vikram S Bartakke <vikram unm edu>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Question about widgets
- Date: Mon, 06 Jan 2003 13:04:12 -0500
> 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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]