Show a label with a message...
- From: Jose Luis Alarcon <jlalarcon tiggerfan com>
- To: gtk-list gnome org
- Subject: Show a label with a message...
- Date: Sun, 15 Dec 2002 09:29:36 -0800 (PST)
Hi gtk-list.
I am very newbie in graphical programming. I have a short and simple program
based in the Gale-Main Tutorial examples, but something must be wrong, cos it don't
work like i wait. this is my program:
**********************************************************************************
/*
* Using GTK.
*/
#include <gtk/gtk.h>
void salute();
void salute_hide();
GtkWidget *ventana;
GtkWidget *caja1;
GtkWidget *caja2;
GtkWidget *caja3;
GtkWidget *message;
GtkWidget *boton1;
GtkWidget *boton2;
int main(int argc, char *argv[])
{
gtk_init(&argc, &argv);
caja1 = gtk_hbox_new(TRUE, 0);
caja2 = gtk_hbox_new(TRUE, 0);
caja3 = gtk_vbox_new(TRUE, 0);
gtk_box_pack_start(GTK_BOX(caja3), caja1, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(caja3), caja2, FALSE, FALSE, 0);
gtk_widget_show(caja1);
gtk_widget_show(caja2);
message = gtk_label_new(" ");
gtk_box_pack_start(GTK_BOX(caja1), message, TRUE, TRUE, 0);
gtk_widget_show(message);
boton1 = gtk_button_new_with_label("Show");
gtk_signal_connect (GTK_OBJECT (boton1), "clicked", GTK_SIGNAL_FUNC (salute), NULL);
boton2 = gtk_button_new_with_label("Hide");
gtk_signal_connect (GTK_OBJECT (boton2), "clicked", GTK_SIGNAL_FUNC (salute_hide), NULL);
gtk_box_pack_start(GTK_BOX(caja2), boton1, TRUE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(caja2), boton2, TRUE, FALSE, 0);
gtk_widget_show(boton1);
gtk_widget_show(boton2);
ventana = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(ventana);
gtk_container_add(GTK_CONTAINER(ventana), caja3);
gtk_widget_show(caja3);
gtk_main();
return 0;
}
void salute (GtkWidget *widget, gpointer data)
{
message = gtk_label_new("This is GTK programming.");
}
void salute_hide (GtkWidget *widget, gpointer data)
{
message = gtk_label_new(" ");
}
**********************************************************************************
I'm trying show a label with a message when i click "Show" button, and hide
this label when button "Hide" is clicked.
Anybody give me a hint?, please. my idea is that i am doing a bad use of
gtk_label_new() or gtk_signal_connect() functions, but......
Thanks very much, in advance.
Regards.
Jose.
Debian GNU/Linux 'Sid' Kernel 2.4.19 Ext3.
ESware Linux 365 Kernel 2.5.49 ReiserFS.
Registered Linux User #213309.
Memories..... You are talking about memories.
Rick Deckard. Blade Runner.
_____________________________________________________________
Get your own free tiggerfan.com email address!!
DisneySites!! - http://www.disneysites.com/webmail/tiggerfan
_____________________________________________________________
Select your own custom email address for FREE! Get you yourchoice com w/No Ads, 6MB, POP & more! http://www.everyone.net/selectmail?campaign=tag
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]