GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Wed Aug 31, 2016 12:27 am

All times are UTC

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Need small help on ZOOM label
PostPosted: Wed Apr 16, 2008 4:30 am 

Joined: Wed Apr 16, 2008 4:02 am
Posts: 1
I'm not a gtk+ programmer. I don't even know C.

I need small help. I spent a week on google and learned few things.

My requirement: I need a button which does Zoom Out of Label.

I tried using Struct , but I'm not able to pass it to callback.

Please look at code. It contains a label and a button. When a button is clicked , label font size should be increased.


#include <gtk/gtk.h>

gint delete_event( GtkWidget *widget,
GdkEvent *event,
gpointer data )

void callback_( GtkWidget *widget,
gpointer data )
// Incriment label font size

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

gtk_init (&argc, &argv);

window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_title (GTK_WINDOW (window), "Hello Buttons!");

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);
label = gtk_label_new ("I Want to ZOOM this text ");

gtk_container_add (GTK_CONTAINER (window), box1);

gtk_box_pack_start(GTK_BOX(box1), label, TRUE, TRUE, 0);


button = gtk_button_new_with_label (" Click me to ZOOM that text ");

gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (callback_), NULL);

gtk_box_pack_start(GTK_BOX(box1), button, TRUE, TRUE, 0);



gtk_widget_show (window);

gtk_main ();


Please Add the extra logic to change the font size or point a relent example.

Thanks in Advance

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group