예제 #1
0
BOOL CPPageMessage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    // TODO: Add extra initialization here
    if (m_bForDBMsg)
    {
        m_ctrlAdd.ShowWindow(SW_HIDE);
        m_ctrlRemove.ShowWindow(SW_HIDE);
    }

    m_odMsgList.SetExtendedStyle(m_odMsgList.GetExtendedStyle()
                                 | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

    RECT Rect;
    m_odMsgList.GetWindowRect(&Rect);

    int nWidth = (Rect.right - Rect.left - 4) / 2;
    m_odMsgList.InsertColumn(0, _("Message ID"), LVCFMT_LEFT, nWidth);
    m_odMsgList.InsertColumn(1, _("Message Text"), LVCFMT_LEFT, nWidth);


    BOOL bAnyMsgEntered = (nInitialiseMsgLCtrl(mUnTotalDBMsgs, mUnDBMsgs) > 0);

    GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(bAnyMsgEntered);
    GetDlgItem(IDC_BUTTON_EDIT)->EnableWindow(bAnyMsgEntered);

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}
예제 #2
0
BOOL CPPageMessage::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    // TODO: Add extra initialization here
    if (m_bForDBMsg)
    {
        m_ctrlAdd.ShowWindow(SW_HIDE);
        m_ctrlRemove.ShowWindow(SW_HIDE);
    }

    m_odMsgList.SetExtendedStyle(m_odMsgList.GetExtendedStyle()
                                 | LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT);

    RECT Rect;
    m_odMsgList.GetWindowRect(&Rect);

    int nWidth = (Rect.right - Rect.left - 4) / 2;
    m_odMsgList.InsertColumn(0, _("Message ID"), LVCFMT_LEFT, nWidth);
    m_odMsgList.InsertColumn(1, _("Message Text"), LVCFMT_LEFT, nWidth);

    UINT unTotalDBMsgs = 0;
    UINT* punDBMsgs = nullptr;
    if ( m_eBusType == LIN )
    {
        m_ouClusterConfig = (ClusterConfig*)m_pouDb;

        m_ouClusterConfig->m_ouFlexChannelConfig[0].m_ouClusterInfo.unListGetMessageIDs(punDBMsgs, unTotalDBMsgs );
    }
    else
    {
        m_pouMsgSigBus = (CMsgSignal*)m_pouDb;
        if ( m_pouMsgSigBus == nullptr)
        {
            return FALSE;
        }

        unTotalDBMsgs = m_pouMsgSigBus->unGetNumerOfMessages();
        if (unTotalDBMsgs > 0)
        {
            punDBMsgs = new UINT[unTotalDBMsgs];
            if (punDBMsgs != nullptr)
            {
                m_pouMsgSigBus->unListGetMessageIDs(punDBMsgs);
            }
        }
    }

    BOOL bAnyMsgEntered = (nInitialiseMsgLCtrl(unTotalDBMsgs, punDBMsgs) > 0);

    GetDlgItem(IDC_BUTTON_REMOVE)->EnableWindow(bAnyMsgEntered);
    GetDlgItem(IDC_BUTTON_EDIT)->EnableWindow(bAnyMsgEntered);

    if( punDBMsgs != nullptr)
    {
        delete[] punDBMsgs;
    }

    return TRUE;  // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
}