GTK+ Forums Forum Index GTK+ Forums
Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Reducing button size

 
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming
Author Message
Turtel
Familiar Face


Joined: 01 Mar 2010
Posts: 34
Location: India

PostPosted: Fri Mar 05, 2010 5:21 am    Post subject: Reducing button size Reply with quote

how do I reduce the button size in the following code-?


/* example-start base base.c */

#include <gtk/gtk.h>
void enter_callback( GtkWidget *widget,
GtkWidget *entry )
{
gint *entry_text;
entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
printf("Entry contents: %s\n", entry_text);
}
int main( int argc,
char *argv[] )
{
static GtkWidget *window;
GtkWidget *vbox;
GtkWidget *hbox1;
GtkWidget *hbox2;
GtkWidget *frame;
GtkWidget *label;
GtkWidget *entry;
GtkWidget *button;
GtkWidget *bbox;

gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

vbox = gtk_vbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_container_set_border_width (GTK_CONTAINER (window), 20);


hbox1 = gtk_hbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (vbox), hbox1);
gtk_box_pack_start (GTK_BOX (vbox), hbox1, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);

frame = gtk_frame_new (NULL);
label = gtk_label_new ("This is a Normal label");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (hbox1), frame, FALSE, FALSE, 0);


entry = gtk_entry_new_with_max_length (50);
gtk_signal_connect(GTK_OBJECT(entry), "activate",
GTK_SIGNAL_FUNC(enter_callback),
entry);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
gtk_entry_append_text (GTK_ENTRY (entry), " world");
gtk_entry_select_region (GTK_ENTRY (entry),
0, GTK_ENTRY(entry)->text_length);
gtk_box_pack_start (GTK_BOX (hbox1), entry, TRUE, TRUE, 0);

hbox2 = gtk_hbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (vbox), hbox2);
gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);

frame = gtk_frame_new (NULL);
label = gtk_label_new ("This is a Normal label");
gtk_container_add (GTK_CONTAINER (frame), label);
gtk_box_pack_start (GTK_BOX (hbox2), frame, FALSE, FALSE, 0);


entry = gtk_entry_new_with_max_length (50);
gtk_signal_connect(GTK_OBJECT(entry), "activate",
GTK_SIGNAL_FUNC(enter_callback),
entry);
gtk_entry_set_text (GTK_ENTRY (entry), "hello");
gtk_entry_append_text (GTK_ENTRY (entry), " world");
gtk_entry_select_region (GTK_ENTRY (entry),
0, GTK_ENTRY(entry)->text_length);
gtk_box_pack_start (GTK_BOX (hbox2), entry, TRUE, TRUE, 0);

frame = gtk_frame_new ("title");
bbox = gtk_hbutton_box_new ();
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
gtk_container_add (GTK_CONTAINER (frame), bbox);
button = gtk_button_new_with_label ("Hello World");
gtk_button_box_set_child_size (GTK_BUTTON_BOX (bbox), 85, 20);

gtk_container_add (GTK_CONTAINER (frame), button);
gtk_box_pack_start (GTK_BOX (frame), button, FALSE, FALSE, 0);

gtk_container_add (GTK_CONTAINER (vbox), bbox);
gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);





gtk_widget_show_all (window);
gtk_main ();

return(0);
}
/* example-end */
Back to top
Turtel
Familiar Face


Joined: 01 Mar 2010
Posts: 34
Location: India

PostPosted: Thu Mar 11, 2010 10:14 am    Post subject: Reply with quote

I have found out this it can be done by using a bbox and button within it.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    GTK+ Forums Forum Index -> GTK+ Programming All times are GMT
Page 1 of 1

 


Powered by phpBB © 2001, 2005 phpBB Group
CodeBB 1.0 Beta 2
Protected by Anti-Spam ACP