+ g_return_val_if_fail (ds, FALSE);
+ g_return_val_if_fail (ds->datasheet, FALSE);
+
+ g_return_val_if_fail (idx < datasheet_get_n_columns (ds->datasheet), FALSE);
+
+ dict = ds->dict;
+
+ width = fmt_var_width (fmt);
+ g_return_val_if_fail (caseproto_get_width (
+ datasheet_get_proto (ds->datasheet), idx) == width,
+ FALSE);
+ value_init (&value, width);
+ ok = (datasheet_get_value (ds->datasheet, casenum, idx, &value)
+ && data_in_msg (input, UTF8, fmt->type, &value, width,
+ dict_get_encoding (dict->dict))
+ && datasheet_put_value (ds->datasheet, casenum, idx, &value));
+ value_destroy (&value, width);
+
+ if (ok)
+ g_signal_emit (ds, signals [CASE_CHANGED], 0, casenum);
+
+ return ok;