语言

Menu
Sites
Language
EEXT_CALLBACK_BACK is not called for Ctxpopup

According to Tizen samples and documentation, to support the hardware Back/More button one needs to add the code:

eext_object_event_callback_add(ad->ctxpopup, EEXT_CALLBACK_BACK, eext_ctxpopup_back_cb, NULL);

But, eext_ctxpopup_back_cb is never called (for Ctxpopup), if I do so.

Here is the corresponding code (that creates Ctxpopup):

static void win_more_cb(void* data, Evas_Object* obj, void* event_info) {
    appdata_s* ad = data;
    if (ad->ctxpopup != NULL) evas_object_del(ad->ctxpopup);

    ad->ctxpopup = elm_ctxpopup_add(ad->win);
    elm_object_style_set(ad->ctxpopup, "more/default");

    eext_object_event_callback_add(ad->ctxpopup, EEXT_CALLBACK_BACK, _eext_ctxpopup_back_cb, NULL);
    eext_object_event_callback_add(ad->ctxpopup, EEXT_CALLBACK_MORE, _eext_ctxpopup_back_cb, NULL);
    evas_object_smart_callback_add(ad->ctxpopup, "dismissed", ctxpopup_dismissed_cb, NULL);

    elm_ctxpopup_item_append(ad->ctxpopup, "Add", NULL, ctxpopup_add_cb, NULL);

    move_more_ctxpopup(ad->ctxpopup);
    evas_object_show(ad->ctxpopup);
}

As you see, I replaced eext_ctxpopup_back_cb with _eext_ctxpopup_back_cb (starts with '_'). The replacement function writes logs - that's how I know, that the callback is never called. Instead, callbacks, which were set for ad->win are called:

eext_object_event_callback_add(ad->win, EEXT_CALLBACK_BACK, win_back_cb, ad);
eext_object_event_callback_add(ad->win, EEXT_CALLBACK_MORE, win_more_cb, ad);

What's wrong? My guess is that Ctxpopup does not receive events, but why?

查看选择的答案

响应

7 回复
s arefin

Hi,

I think you should declare and define _eext_ctxpopup_back_cb function before calling it in

eext_object_event_callback_add(ad->ctxpopup, EEXT_CALLBACK_BACK, _eext_ctxpopup_back_cb, NULL);

See win_back_cb definition for creating your version of callback function.

Hope it will help.

Andriy Lesyuk

I did this. It's declared before win_more_cb, where it's called. So, it's not the cause of the problem.

Thanks anyway.

Yasin Ali

Could you please share your full code to test.

Andriy Lesyuk

Actually, the code in the original post should be enough for reproducing this. Looks like, it's not a problem in the code (see my comment below).

Andriy Lesyuk

Update: I had a crazy theory, that the code can work on a real device (it did not work in emulator). So, to test this theory I went through all the circles of hell to deploy my not-yet-ready app to a Tizen device. And, voila! The Back button worked like a charm there! So, my theory appeared to be not so crazy...

But, why?.. I wonder, if I should expect some other things not to work in emulator too...

Yasin Ali

I think you may raise a bug report here https://www.tizen.org/community/bug-tracker/how-report-bugs.
Before raising it you may uninstall current emulator image and download new emulator image
to check it again.

Mark as answer
Andriy Lesyuk

I managed to fix this for emulator too:

I figured out that the EEXT_CALLBACK_BACK is not called for a СtxPopup (as well as for NaviFrame, that I added later), if any of the hardware callbacks (EEXT_CALLBACK_BACK or EEXT_CALLBACK_MORE) is set for the main window (ad->win). As soon as I moved EEXT_CALLBACK_MORE to a NaviFrame, the hardware Back button started to work in emulator as well.

So, generally, it looks like these two callbacks should not ever be set for the main window. If they are, child components do not receive hardware Back and More events.