Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Contributor
Posts: 16
Registered: ‎01-05-2012
My Device: Playbook, Curve 9360

standardAskAsync within a callback in BB10 does not work??!

I wanted to ask the user with a yes/no prompt. According to response of  that I want to call the save code and show message with OK prompt. After closing the prompt I want to do some task, for example, I want to close the screen. However, after trying many times, it seems to me that a call from callback function does not work. Can anybody please try this, here is the code

 

        var afterResponse = function (selection) {

            if (selection["return"] == "Yes") {

                var closeScreen = function (sel) {

                    // this is not called

                    alert("test");

                };

                try {

                    blackberry.ui.dialog.standardAskAsync("2nd", blackberry.ui.dialog.D_OK, closeScreen, { title: "Settings", size: blackberry.ui.dialog.SIZE_MEDIUM, position: blackberry.ui.dialog.BOTTOM });

                }

                catch (e) {

                    console.log(e);

                }

            }

        };

        try {

            blackberry.ui.dialog.standardAskAsync("Yes or no?", blackberry.ui.dialog.D_YES_NO, afterResponse, { title: "Settings", size: blackberry.ui.dialog.SIZE_MEDIUM, position: blackberry.ui.dialog.BOTTOM });

        }

        catch (e) {

            console.log(e);

        }