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

Native Development

Reply
New Developer
Posts: 2
Registered: ‎07-24-2014
My Device: blackberry 10
My Carrier: cdma
Accepted Solution

why SystemListDialog selectedIndices() no value?

void Xkqzglch::showDialog()
{
    if (actionValueList_.isEmpty())
    {
        SystemDialog *dialog = new SystemDialog("确定");
        dialog->setEmoticonsEnabled(true);
        dialog->setTitle("提示");
        dialog->setBody("暂时无需处理。");
        dialog->show();
        return;
    }

    bool success = false;
    if (lstDialog_)
    {
        lstDialog_->clearList();
        success = true;
//        lstDialog_->deleteLater();
//        lstDialog_ = NULL;
        Logger::DebugEx("success = true");
    } else
    {
        lstDialog_ = new SystemListDialog("取消", "确定");
        lstDialog_->setEmoticonsEnabled(true);
        lstDialog_->setTitle("请选择");
        Logger::DebugEx("success = connect");
        success = connect(lstDialog_, SIGNAL(finished(bb::system::SystemUiResult::Type)), this, SLOT(onDialogFinished(bb::system::SystemUiResult::Type)));
    }

    if (success)
    {
        for (int i = 0; i < actionValueList_.count(); i++)
        {
            QString action = actionValueList_.value(i)->changeText_;
            lstDialog_->appendItem(action, true, false);
        }
        lstDialog_->show();
        Logger::DebugEx("lstDialog_->show()");
    } else
    {
        Logger::DebugEx("lstDialog_->deleteLater()");
        lstDialog_->deleteLater();
        lstDialog_ = NULL;
    }
}

void Xkqzglch::onDialogFinished(bb::system::SystemUiResult::Type value)
{
    if (value != bb::system::SystemUiResult::CancelButtonSelection)
    {
        Logger::DebugEx("Xkqzglch::onDialogFinished:onDialogFinished.....cancel......");
        return;
    }
    QList<int> lst = lstDialog_->selectedIndices();
    if (lst.count() > 0)
    {
        Logger::DebugEx("Xkqzglch::onDialogFinished.....ok..selected:=" + lstDialog_->selectedIndices().at(0) );
        Logger::DebugEx("Xkqzglch::onDialogFinished.....ok..selected:=" + lst.at(0) );
        Logger::DebugEx("Xkqzglch::onDialogFinished.....ok..selected:=" + lst.first() );
}
}

 The lstDialog_->selectedIndices()  debugex  no any value,but  (lst.count() > 0)  is true.

New Developer
Posts: 2
Registered: ‎07-24-2014
My Device: blackberry 10
My Carrier: cdma

Re: why SystemListDialog selectedIndices() no value?

Solved the problem