From 2a8f45a304f2f4de8c6066b92804276d57870a93 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 12 Apr 2011 06:45:33 -0700 Subject: [PATCH] DISPLAY: Display values for value labels using the variable's format. Until now, the values in value labels have been displayed as plain numbers, but this makes the values for variables with date and time formats unreadable. Changing them to use the variable's own format makes them easier to read. --- src/language/dictionary/sys-file-info.c | 12 +----------- tests/language/stats/autorecode.at | 8 ++++---- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/src/language/dictionary/sys-file-info.c b/src/language/dictionary/sys-file-info.c index fc875384c1..7653e046bd 100644 --- a/src/language/dictionary/sys-file-info.c +++ b/src/language/dictionary/sys-file-info.c @@ -584,18 +584,8 @@ describe_variable (const struct variable *v, struct tab_table *t, int r, for (i = 0; i < n_labels; i++) { const struct val_lab *vl = labels[i]; - char buf[MAX_STRING + 1]; - if (var_is_alpha (v)) - { - int width = var_get_width (v); - memcpy (buf, value_str (&vl->value, width), width); - buf[width] = 0; - } - else - sprintf (buf, "%g", vl->value.f); - - tab_text (t, 1, r, TAB_NONE, buf); + tab_value (t, 1, r, TAB_NONE, &vl->value, v, NULL); tab_text (t, 2, r, TAB_LEFT, val_lab_get_label (vl)); r++; } diff --git a/tests/language/stats/autorecode.at b/tests/language/stats/autorecode.at index bd9d59f7c4..7f5e6eb376 100644 --- a/tests/language/stats/autorecode.at +++ b/tests/language/stats/autorecode.at @@ -100,10 +100,10 @@ new,Format: F8.2,,3 ,Measure: Scale,, ,Display Alignment: Right,, ,Display Width: 8,, -,1,oojars, -,2,oojimiflips, -,3,thingummies, -,4,widgets, +,1.00,oojars, +,2.00,oojimiflips, +,3.00,thingummies, +,4.00,widgets, ]) AT_CLEANUP -- 2.30.2