| | |
| | | ON_WM_SIZE() |
| | | ON_BN_CLICKED(IDC_BUTTON_PLC_AXIS_SETTINGS, &CComponentPLCDlg::OnBnClickedButtonAxisSetting) |
| | | ON_BN_CLICKED(IDC_BUTTON_PLC_IO, &CComponentPLCDlg::OnBnClickedButtonIO) |
| | | ON_WM_TIMER() |
| | | END_MESSAGE_MAP() |
| | | |
| | | |
| | |
| | | // onNext |
| | | pAny->addRef(); |
| | | int code = pAny->getCode(); |
| | | if (RX_CODE_ALARM_EVENT == code) { |
| | | |
| | | if (RX_CODE_PLC1_CONNECTTD == code) { |
| | | CComponent* pComponent; |
| | | if (pAny->getPtrValue("ptr", (void*&)pComponent) |
| | | && pComponent == m_pContext) { |
| | | EnableGroup1(TRUE); |
| | | } |
| | | } |
| | | else if (RX_CODE_PLC1_DISCONNECTTD == code) { |
| | | CComponent* pComponent; |
| | | if (pAny->getPtrValue("ptr", (void*&)pComponent) |
| | | && pComponent == m_pContext) { |
| | | EnableGroup1(FALSE); |
| | | } |
| | | } |
| | | pAny->release(); |
| | | }, [&]() -> void { |
| | |
| | | BOOL CComponentPLCDlg::OnInitDialog() |
| | | { |
| | | CComponentDlg::OnInitDialog(); |
| | | |
| | | SetTimer(1, 200, NULL); |
| | | |
| | | return TRUE; // return TRUE unless you set the focus to a control |
| | | // 异常: OCX 属性页应返回 FALSE |
| | | } |
| | | |
| | | void CComponentPLCDlg::OnTimer(UINT_PTR nIDEvent) |
| | | { |
| | | // TODO: 在此添加消息处理程序代码和/或调用默认值 |
| | | if (1 == nIDEvent) { |
| | | KillTimer(1); |
| | | InitRxWindows(); |
| | | CPLC* pPLC = (CPLC*)m_pContext; |
| | | EnableGroup1(pPLC->isConnected()); |
| | | } |
| | | |
| | | CComponentDlg::OnTimer(nIDEvent); |
| | | } |
| | | |
| | | HBRUSH CComponentPLCDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) |
| | | { |
| | |
| | | void CComponentPLCDlg::OnBnClickedButtonAxisSetting() |
| | | { |
| | | CAxisSettingsDlg axisDlg; |
| | | axisDlg.SetPLC(theApp.m_model.getBonder().getPLC("PLC(1)")); |
| | | axisDlg.SetPLC((CPLC*)m_pContext); |
| | | axisDlg.SetRecipeName(_T("Default")); |
| | | axisDlg.DoModal(); |
| | | } |
| | |
| | | dlg.DoModal(); |
| | | } |
| | | |
| | | void CComponentPLCDlg::EnableGroup1(BOOL bEnable) |
| | | { |
| | | GetDlgItem(IDC_BUTTON_PLC_AXIS_SETTINGS)->EnableWindow(bEnable); |
| | | GetDlgItem(IDC_BUTTON_PLC_IO)->EnableWindow(bEnable); |
| | | } |
| | | |