spinner: spinner's entry value re-arrange. 75/85075/1
authorWoochan Lee <wc0917.lee@samsung.com>
Tue, 23 Aug 2016 12:25:29 +0000 (21:25 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Tue, 23 Aug 2016 12:28:22 +0000 (21:28 +0900)
Set entry value to spinner's min value if the current input value is smaller than spinner's min value.
otherwise, set to spinner's max value.

Change-Id: I89477e4b20f5eb00889fa830ced0006546e2abf1

src/lib/elm_spinner.c

index db5d4bd..cc68f4b 100644 (file)
@@ -620,8 +620,28 @@ _min_max_validity_filter(void *data, Evas_Object *obj, char **text)
    val = strtod(new_str, NULL);
    ELM_SAFE_FREE(new_str, free);
 
-   if ((val < sd->val_min) || (val > sd->val_max))
-     *insert = 0;
+   //TIZEN_ONLY(20160823): Set min,max value to entry. instread of deleting last input value.
+   //if ((val < sd->val_min) || (val > sd->val_max))
+   //  *insert = 0;
+   char buf[1024];
+
+   if (val < sd->val_min) val = sd->val_min;
+   else if (val > sd->val_max) val = sd->val_max;
+   else return;
+
+   if (sd->label)
+     {
+        if (_is_label_format_integer(sd->label))
+          snprintf(buf, sizeof(buf), sd->label, (int)val);
+        else
+          snprintf(buf, sizeof(buf), sd->label, val);
+     }
+   else
+     snprintf(buf, sizeof(buf), "%.0f", val);
+
+   *insert = 0;
+   elm_object_text_set(obj, buf);
+   //
 }
 
 static void