Why i is not recognized correctly in the callback?
I think that maybe because after add_strip() "i" is destroyed, so how could i pass an int to that callback? Thanks.
29 void add_strip(int i,char name[30]){
30 sl[i] = elm_slider_add(win);
31 elm_slider_label_set(sl[i], name);
32 elm_slider_unit_format_set(sl[i], "dB");
33 elm_slider_span_size_set(sl[i], 60);
34 evas_object_size_hint_align_set(sl[i], 0.5, EVAS_HINT_FILL);
35 evas_object_size_hint_weight_set(sl[i], 0.0, EVAS_HINT_EXPAND);
36 elm_slider_indicator_format_set(sl[i], "%3.0f");
37 elm_slider_min_max_set(sl[i], 0, 2);
38 elm_slider_inverted_set(sl[i], 1);
39 elm_slider_value_set(sl[i], 0);
40 elm_object_scale_set(sl[i], 1.0);
41 elm_slider_horizontal_set(sl[i], 0);
42 elm_box_pack_end(bx, sl[i]);
43 evas_object_show(sl[i]);
44 evas_object_smart_callback_add(sl[i], "changed", vol_changed, &i); // <--------------
45 }
And the callback is:
13 static void
14 vol_changed(void *data, Evas_Object *obj, void *event_info)
15 {
16 int n = *((int*)data);
17 printf("%d\n", &n); // <------------------------------------- this prints always -1078364196 (seems an address)
18
19 if(lo_send(dest, "/fader/0", "f", elm_slider_value_get(sl[0]))==-1)
20 printf("OSC error %d: %s\n", lo_address_errno(dest), lo_address_errstr(d est));
21 }