gtk_bin and Frame problem



Hi *,
    I am having a bit (byte?) of a problem when using this convenience
    function below. The function creates a Label + Entry pair on an
    HBox. This is then 'appended' to the frame that was created within
    a Notebook Tab:

     Notebook
        \_______ Tab[1]
	          \___ Frame
		         \____ HBox { Label + Entry }[1]
		         

   It works fine with the first labelEntry addition to the tab's frame, I
   also see it when I switch to that particular tab.

    /* These 3 tabs are created without problems */
    GcCreateTab(nbook, &configTab, "Configuration", "TAB1", GcTabAppend);
    GcCreateTab(nbook, &outputTab, "Output", "TAB2", GcTabAppend);
    GcCreateTab(nbook, &editTab, "Edit", "TAB3", GcTabAppend);

    /* Of these 3 Label+Entry combos only the first appears. */
    GcLblEntry(configTab.frame, "Editor", CORE_CFG_EDITORLEN - 1);
    GcLblEntry(configTab.frame, "Server Name", CORE_SITE_NAMELEN - 1);
    GcLblEntry(configTab.frame, "Server Desc", CORE_SITE_DESCLEN - 1);

   When I try to add the 2nd and 3rd LblEntry to the same frame they don't
   get mapped, in fact I get a run time error:

    ** WARNING **: file gtkbin.c: line 203 (gtk_bin_add): "bin->child == NULL"

    ** WARNING **: file gtkbin.c: line 203 (gtk_bin_add): "bin->child == NULL"

   so one for the 2nd and one for the 3rd. If I have one only it works fine.
   Can anybody tell me what I am doing wrong? I added checking on 'NULL' for
   the frame, hBox, Lbl and Entry and none of them are NULL. Hope to hear
   some feedback.

   		Cheers,
			Emilio

   
*** CODE SNIPPET FOLLOWS ***
GtkWidget *GcLblEntry(GtkWidget *parent, char *lbltxt, guint16 maxlen)
{
    GtkWidget *Box;
    GtkWidget *Lbl;
    GtkWidget *Entry;

    Box = gtk_hbox_new(FALSE, 1);
    DBG(checkWidget(Box,"hBox", __FILE__, __LINE__));
    gtk_container_add(GTK_CONTAINER(parent), Box);
    gtk_widget_show(Box);

    Lbl = gtk_label_new(lbltxt);
    gtk_box_pack_start(GTK_BOX(Box), Lbl, FALSE, FALSE, 3);
    gtk_widget_show(Lbl);

    if (maxlen == 0) {
	Entry = gtk_entry_new();
    } else {
#ifdef GTK099
	/* GTK v0.99.970925 does not have gtk_entry_new_with_max_length() */
	Entry = gtk_entry_new();
#else
	Entry = gtk_entry_new_with_max_length(maxlen);
#endif
    }
    gtk_box_pack_start(GTK_BOX(Box), Entry, FALSE, TRUE, 3);
    gtk_widget_show(Entry);
    return(Entry);
}
*** END ***
-- 
      __o          "Admit nothing, deny everything, demand proof. :)"
    _`\<,_           -James Ebbs
___(*)/_(*)____.___o____..___..o...________ooO..._____________________
                    D. Emilio Grimaldo Tunon
http://www.iaehv.nl/users/grimaldo/
http://www.iaehv.nl/users/grimaldo/cv/
http://www.iaehv.nl/users/grimaldo/panama.html
http://www.iaehv.nl/users/grimaldo/Linux/



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