Column Values Changing in Treeview When Row Selected



All,

I'm not sure what I'm doing wrong.  When I select a row in a treeview,
the values of the columns are read and used to populate various entries
and combos.  The thing that I can't figure out is that the value of one
column is being changed to the value of another column.

Below is a snippet of the function (ANNOTATED IN CAPS) wherein the
column value is changing.  Running my app in gdb, I've been able to
figure out where the change is occurring, but not why.  I've looked at
the API docs for GTK+ and studied the use of gtk_tree_model_get at
codase.com.  I don't see anything in my code that should cause this
behavior.  I've also tried to use gtk_tree_model_get_value and the same
thing occurs.

Any pointer, hints, outright solutions, or swift kicks in the keister
would be greatly appreciated.

TIA,

Andrew "Weibullguy" Rowland

------- CODE FOLLOWS -------

gboolean
populate_part_general_tab( GtkTreeModel *model,
                           GtkTreeIter  *iter )
{

    gchar *string = NULL;
    gfloat *floater;
    gint *integer;

    /* Populate the usage information. */
    gtk_tree_model_get( model, iter, PART_COLUMN_PN, &string, -1 );
    gtk_entry_set_text( GTK_ENTRY(part_number), string );
    gtk_tree_model_get( model, iter, PART_COLUMN_REFDES, &string, -1 );
    gtk_entry_set_text( GTK_ENTRY(ref_des), string );
    gtk_tree_model_get( model, iter, PART_COLUMN_COMPREFDES, &string, -
1 );
    gtk_entry_set_text( GTK_ENTRY(comp_ref_des), string );
    gtk_tree_model_get( model, iter, PART_COLUMN_DESC, &string, - 1 );
    gtk_entry_set_text( GTK_ENTRY(description), string );
    gtk_tree_model_get( model, iter, PART_COLUMN_QUANT, &integer, - 1 );
    snprintf(string, 3, "%d", integer);
    gtk_entry_set_text( GTK_ENTRY(quantity), string );

    /* Set the part type combo box. */
    gtk_tree_model_get( model, iter, PART_COLUMN_CLASS, &integer, - 1 );

AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 1, WHICH IS CORRECT

    gtk_combo_box_set_active( GTK_COMBO_BOX( part_type ), integer);

AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 0, WHICH IS INCORRECT

    /* Set the part subtype combo box. */
    gtk_tree_model_get( model, iter, PART_COLUMN_COMP_SUBTYPE, &integer,
- 1 );

AT THIS POINT THE VALUE OF PART_COLUMN_CLASS IS 3, WHICH IS INCORRECT
FOR PART_COLUMN_CLASS.  BUT IS THE CORRECT VALUE OF
PART_COLUMN_COMP_SUBTYPE.

    gtk_combo_box_set_active( GTK_COMBO_BOX( part_subclass ), integer );

-- 
Visit the ReliaFree Project at http://reliafree.sourceforge.net/

Please do not send me *.doc, *.xls, *.ppt, or *.mdb files.  They are a 
proprietary format and do not conform to any recognized standards available 
in the public domain.  I have no need for the proprietary programs used to 
view and edit these file types and prefer standards-compliant formats.




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