more widget size problems/questions



hi,

i need help again. i'm having a helluva time getting the
size of widgets... could anyone offer reason why the following
code does not give me the actual dimension of the helpfind
widget? the call to gtk_widget_size_request() tells me
this widget is 12x12. 

what am i missing here?

thanks!
brent


void
do_helpfind()
{    
    GtkWidget *vbox, *hbox, *tmp;
    GtkRequisition w_size;

/* unrelated stuff snipped here */

    helpfind = gtk_window_new(GTK_WINDOW_DIALOG);
#ifdef GTK_HAVE_FEATURES_1_1_4
    gtk_window_set_transient_for(GTK_WINDOW(helpfind), GTK_WINDOW(gui.mainwin));
#endif
    /* gtk_window_position(GTK_WINDOW(helpfind), GTK_WIN_POS_MOUSE); */
    gtk_window_set_title(GTK_WINDOW(helpfind), "VIM - Help on what?");
    gtk_signal_connect(GTK_OBJECT(helpfind), "destroy",
		       GTK_SIGNAL_FUNC(gtk_widget_destroyed), &helpfind);

    vbox = gtk_vbox_new(FALSE, 6);
    gtk_container_add(GTK_CONTAINER(helpfind), vbox);
    gtk_container_border_width(GTK_CONTAINER(helpfind), 6);
    
    hbox = gtk_hbox_new(FALSE, 6);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);

    tmp = gtk_label_new("Topic: ");
    gtk_box_pack_start(GTK_BOX(hbox), tmp, TRUE, TRUE, 0);

    help_entry = gtk_entry_new();
    gtk_box_pack_start(GTK_BOX(hbox), help_entry, TRUE, TRUE, 0);

    tmp = gtk_hseparator_new();
    gtk_box_pack_start(GTK_BOX(vbox), tmp,  FALSE, TRUE, 0);

    hbox = gtk_hbutton_box_new();
    gtk_button_box_set_layout(GTK_BUTTON_BOX(hbox), GTK_BUTTONBOX_EDGE);
    gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 0);
    gtk_container_border_width(GTK_CONTAINER(hbox), 0);
    gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);

    tmp = gui_gtk_button_new_with_label("Ok",
					GTK_SIGNAL_FUNC(helpfind_ok),
					help_entry, hbox, FALSE, FALSE, FALSE);
    gtk_signal_connect(GTK_OBJECT(help_entry), "changed",
		       GTK_SIGNAL_FUNC(helpfind_entry_changed), tmp);
    gtk_signal_connect(GTK_OBJECT(help_entry), "activate",
		       GTK_SIGNAL_FUNC(helpfind_ok), help_entry);
    gtk_widget_set_sensitive(tmp, FALSE);
    GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_DEFAULT);

    tmp = gui_gtk_button_new_with_label("Cancel",
					GTK_SIGNAL_FUNC(gtk_widget_destroy),
					helpfind, hbox, TRUE, FALSE, FALSE);
    GTK_WIDGET_SET_FLAGS(tmp, GTK_CAN_DEFAULT);
    gtk_widget_grab_default(tmp);

    gtk_widget_grab_focus(help_entry);
    gtk_widget_show(hbox);
    gtk_widget_show(vbox);

    gtk_widget_realize(helpfind);
    
    gtk_widget_size_request( GTK_WIDGET(helpfind), &w_size );
    /* after this call, w_size.height == 12 and w_size.width == 12
       what am i not doing to get the proper dimension of this widget? */
    
    gtk_widget_show_all(helpfind);
}



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