2016-08-12 6 views
0

시계 모양의 Tizen 기본 앱을 개발하고 있습니다. 나는이 코드를 사용하여 텍스트를 업데이트하기 위해 노력하고있어 update_watch 기능에서텍스트를 라벨로 업데이트하는 방법은 무엇입니까?

typedef struct appdata { 
    Evas_Object *win; 
    Evas_Object *conform; 
    Evas_Object *label; 
    Evas_Object *box; 
} appdata_s; 

static void 
create_base_gui(appdata_s *ad, int width, int height) 
{ 
    int ret; 
    watch_time_h watch_time = NULL; 

    /* Window */ 
    ret = watch_app_get_elm_win(&ad->win); 
    if (ret != APP_ERROR_NONE) { 
     dlog_print(DLOG_ERROR, LOG_TAG, "failed to get window. err = %d", ret); 
     return; 
    } 

    evas_object_resize(ad->win, width, height); 

    /* Conformant */ 
    ad->conform = elm_conformant_add(ad->win); 
    evas_object_size_hint_weight_set(ad->conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 
    elm_win_resize_object_add(ad->win, ad->conform); 

    /* Box */ 
    ad->box = elm_box_add(ad->conform); 
    evas_object_show(ad->box); 
    elm_object_content_set(ad->conform, ad->box); 

    ad->label = elm_label_add(ad->box); 
    evas_object_size_hint_align_set(ad->label, 0.5, 0.5); 
    elm_object_text_set(ad->label, "Time"); 
    evas_object_show(ad->label); 
    elm_box_pack_end(ad->box, ad->label); 

    ret = watch_time_get_current_time(&watch_time); 
    if (ret != APP_ERROR_NONE) 
     dlog_print(DLOG_ERROR, LOG_TAG, "failed to get current time. err = %d", ret); 

    update_watch(ad, watch_time, 0); 
    watch_time_delete(watch_time); 

    /* Show window after base gui is set up */ 
    evas_object_show(ad->win); 
} 

:

나는 기본 create_base_gui 기능을 사용하여 기본 GUI를 생성

static void 
update_watch(appdata_s *ad, watch_time_h watch_time, int ambient) 
{ 
    char watch_text[TEXT_BUF_SIZE]; 
    int hour24, minute, second; 
    int time; 

    if (watch_time == NULL) 
     return; 

    watch_time_get_hour24(watch_time, &hour24); 
    watch_time_get_minute(watch_time, &minute); 
    watch_time_get_second(watch_time, &second); 

    elm_object_text_set(ad->label, "Update"); 
} 

을하지만 그것은 작동하지 않습니다 .

무엇이 오류입니까?

답변

1

처음입니다. evas_object_show(ad->conform); 가 보이지 않는 컨트롤을 준수하도록 설정합니다.

그리고 업데이트 시계 기능이 매번 작동하지 않는 경우 watch_app_lifecycle_callback_s 구조의 time_tick 콜백에서 호출하도록합니다.

+0

죄송하지만 모든 코드를 게시 할 수 없습니다. app_time_tick 함수도 있습니다. 수정 된 코드 만 붙여 넣었습니다. – vittochan

+0

코드가 작동하지 않는 방법은 무엇입니까? 표시되지 않는 컨트롤입니까? 또는 텍스트가 변경되지 않았습니까? 귀하의 코드에서 "업데이트"고정 문자열을 레이블로 설정합니다. 물론 변화하지 않습니다. –

+0

텍스트가 업데이트되지 않고 문자열 "시간"으로 유지됩니다. – vittochan