Ejemplo n.º 1
0
void CAutoInfo::UpdateList()
{
    CExchangePost* object = static_cast<CExchangePost*>(m_object);

    Ui::CWindow* pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
    if (pw == nullptr)  return;

    Ui::CList* pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
    if (pl == nullptr)  return;

    pl->Flush();
    const auto& infoList = object->GetInfoList();
    if (infoList.empty())
    {
        pl->ClearState(Ui::STATE_ENABLE);
    }
    else
    {
        pl->SetState(Ui::STATE_ENABLE);

        for (int i = 0; i < static_cast<int>(infoList.size()); i++)
        {
            char text[100];
            sprintf(text, "%s = %.2f", infoList[i].name.c_str(), infoList[i].value);
            pl->SetItemName(i, text);
        }
    }

    object->SetInfoUpdate(false);
}
Ejemplo n.º 2
0
void CAutoInfo::UpdateList()
{
    Ui::CWindow*    pw;
    Ui::CList*      pl;
    Info        info;
    int         total, i;
    char        text[100];

    pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
    if ( pw == nullptr )  return;

    pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
    if ( pl == nullptr )  return;

    pl->Flush();
    total = m_object->GetInfoTotal();
    if ( total == 0 )
    {
        pl->ClearState(Ui::STATE_ENABLE);
    }
    else
    {
        pl->SetState(Ui::STATE_ENABLE);

        for ( i=0 ; i<total ; i++ )
        {
            info = m_object->GetInfo(i);
            sprintf(text, "%s = %.2f", info.name, info.value);
            pl->SetItemName(i, text);
        }
    }

    m_object->SetInfoUpdate(false);
}