Set the cell value when the reference entry changes
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 4 Sep 2017 16:40:02 +0000 (18:40 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 4 Sep 2017 16:40:02 +0000 (18:40 +0200)
src/ui/gui/psppire-data-editor.c

index 27a4b63ab30a0e8c81b88adb29edc2c1ed909b9e..0efd8ce835186de958d58e28f704b1ff9c38e83d 100644 (file)
@@ -345,8 +345,23 @@ refresh_entry (PsppireDataEditor *de)
 }
 
 static void
-on_datum_entry_activate (PsppireValueEntry *entry, PsppireDataEditor *de)
+on_datum_entry_activate (GtkEntry *entry, PsppireDataEditor *de)
 {
+  gint row, col;
+  if (ssw_sheet_get_active_cell (SSW_SHEET (de->data_sheet), &col, &row))
+    {
+      union value val;
+      const struct variable *var = psppire_dict_get_variable (de->dict, col);
+      if (var == NULL)
+       return;
+
+      value_init (&val, var_get_width (var));
+
+      if (psppire_value_entry_get_value (de->datum_entry, &val, var_get_width (var)))
+       {
+         psppire_data_store_set_value (de->data_store, row, var, &val);
+       }
+    }
 }