int CuDlgMain::GetInstallationParam(int nSchema) { int nInstallation = -1; CRect r1, r2, re; CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2; CEdit* pEditFile = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2; if (pEditFile->IsWindowVisible()) { CString strFile; pEditFile->GetWindowText(strFile); strFile.TrimLeft(); strFile.TrimRight(); if (strFile.IsEmpty()) return -1; if (_taccess(strFile, 0) == -1) return -1; nInstallation = IsInstallationFile(strFile); } else { int nSel = pComboDatabase->GetCurSel(); if (nSel != CB_ERR) { CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel); if (pDatabase) { CString strDb = pDatabase->GetItem(); nInstallation = strDb.IsEmpty()? 1: 0; } } } return nInstallation; }
void CRevisionGraphDlg::UpdateZoomBox() { CString strText; CString strItem; CComboBoxEx* pCBox = (CComboBoxEx*)m_ToolBar.GetDlgItem(ID_REVGRAPH_ZOOMCOMBO); pCBox->GetWindowText(strItem); strText.Format(_T("%.0f%%"), (m_fZoomFactor*100.0)); if (strText.Compare(strItem) != 0) pCBox->SetWindowText(strText); }
void CRevisionGraphDlg::OnChangeZoom() { if (!IsWindow(m_Graph.GetSafeHwnd())) return; CString strItem; CComboBoxEx* pCBox = (CComboBoxEx*)m_ToolBar.GetDlgItem(ID_REVGRAPH_ZOOMCOMBO); pCBox->GetWindowText(strItem); if (strItem.IsEmpty()) return; DoZoom ((float)(_wtof(strItem) / 100.0)); }
CComboBox* CComboBoxExProp::CreateCombo(CWnd* pWndParent, CRect rect) { rect.bottom = rect.top + 400; CComboBoxEx* pWndCombo = new CComboBoxEx; if (!pWndCombo->Create(WS_CHILD | CBS_DROPDOWNLIST | WS_VSCROLL, rect, pWndParent, AFX_PROPLIST_ID_INPLACE)) { delete pWndCombo; return NULL; } if (m_pImageList != NULL) { pWndCombo->SetImageList(m_pImageList); } return pWndCombo; }
void DialogObjProp::OP_COMPCB() { CComboBox* complb = (CComboBox*)GetDlgItem(IDC_CBCOMPONENT); CListBox* objList = (CListBox*)parentWnd->GetObjList()->GetDlgItem(IDC_OBJLIST); int curSel = complb->GetCurSel() ; Gameobject* obj = parentWnd->theApp->GetProject()->GetScene()->GetSceneObject(objList->GetCurSel()); Component* compSel = obj->GetComponent(curSel); if (strcmp(compSel->GetIdentifier(),CTYPE_MESHRENDERER)) { ClearTempIDS(); RECT tr; tr.top = 275; tr.left = 40; tr.bottom = tr.top + 20; tr.right = tr.left + 120; CStatic* text = new CStatic(); text->Create("Linked Mesh: ",WS_VISIBLE,tr,this,TEMPID_0); text->ShowWindow(SW_SHOW); tr.top = 300; tr.bottom = tr.top + 30; CComboBoxEx* cb = new CComboBoxEx(); cb->Create(WS_VISIBLE,tr,this,TEMPID_1); cb->ShowWindow(SW_SHOW); for (int i = 0, ListItem = 1; i < obj->GetNumberOfComponent(); i++) { if (strcmp(obj->GetComponent(i)->GetIdentifier(), CTYPE_MESH) ) { char name[512]; obj->GetComponent(i)->GetName(name, 512);/* cb->AddString(name); cb->SetItemData(ListItem, i);*/ ListItem++; } } } }
BOOL CComboBoxExProp::OnEdit(LPPOINT lptClick) { if (!CMFCPropertyGridProperty::OnEdit(lptClick)) { return FALSE; } CComboBoxEx* pWndComboEx = DYNAMIC_DOWNCAST(CComboBoxEx, m_pWndCombo); if (pWndComboEx == NULL) { ASSERT(FALSE); return FALSE; } pWndComboEx->ResetContent(); int i = 0; COMBOBOXEXITEM item; memset(&item, 0, sizeof(item)); item.mask = CBEIF_IMAGE | CBEIF_INDENT | CBEIF_SELECTEDIMAGE | CBEIF_TEXT; for (POSITION pos = m_lstOptions.GetHeadPosition(); pos != NULL; i++) { CString strItem = m_lstOptions.GetNext(pos); item.iItem = i; item.iSelectedImage = item.iImage = m_lstIcons [i]; item.iIndent = m_lstIndents [i]; item.pszText = (LPTSTR)(LPCTSTR) strItem; item.cchTextMax = strItem.GetLength(); pWndComboEx->InsertItem(&item); } return TRUE; }
BOOL CuDlgMain::GetSchemaParam (int nSchema, CString& strNode, CString& strDatabase, CString& strUser) { int nSel = -1; CComboBoxEx* pComboNode = (nSchema == 1)? &m_cComboNode1: &m_cComboNode2; CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2; CComboBoxEx* pComboUser = (nSchema == 1)? &m_cComboUser1: &m_cComboUser2; nSel = pComboNode->GetCurSel(); if (nSel == CB_ERR) throw (int)1; CaNode* pNode = (CaNode*)pComboNode->GetItemDataPtr(nSel); if (!pNode) throw (int)1; nSel = pComboDatabase->GetCurSel(); if (nSel == CB_ERR) throw (int)2; CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel); if (!pDatabase) throw (int)2; nSel = pComboUser->GetCurSel(); if (nSel == CB_ERR) throw (int)3; CaUser* pUser = (CaUser*)pComboUser->GetItemDataPtr(nSel); if (!pUser) throw (int)3; strNode = pNode->GetName(); strDatabase = pDatabase->GetItem(); strUser = pUser->GetItem(); if (strNode.IsEmpty()) return FALSE; if (strDatabase.IsEmpty()) strUser = _T(""); return TRUE; }
void CuDlgMain::ShowShemaFile(int nSchema, BOOL bShow, LPCTSTR lpszFile) { CRect r1, r2, re; CComboBoxEx* pComboNode = (nSchema == 1)? &m_cComboNode1: &m_cComboNode2; CComboBoxEx* pComboDatabase = (nSchema == 1)? &m_cComboDatabase1: &m_cComboDatabase2; CComboBoxEx* pComboUser = (nSchema == 1)? &m_cComboUser1: &m_cComboUser2; CEdit* pEditFile = (nSchema == 1)? &m_cEditFile1: &m_cEditFile2; CButton* pSaveButton= (nSchema == 1)? &m_cButtonSc1Save: &m_cButtonSc2Save; pComboNode->GetWindowRect (r1); ScreenToClient (r1); pComboUser->GetWindowRect (r2); ScreenToClient (r2); pEditFile->GetWindowRect (re); ScreenToClient (re); int nHeight = re.Height(); re.left = r1.left; re.top = r1.top; re.right = r2.right; re.bottom = re.top + nHeight; pEditFile->MoveWindow(re); int nDbms = bShow? SW_HIDE: SW_SHOW; int nDFile = bShow? SW_SHOW: SW_HIDE; HICON hIcon= bShow? m_hIconNode: m_hIconSave; pComboNode->ShowWindow (nDbms); pComboDatabase->ShowWindow (nDbms); pComboUser->ShowWindow (nDbms); pEditFile->ShowWindow (nDFile); if (lpszFile) pEditFile->SetWindowText (lpszFile); pSaveButton->SetIcon(hIcon); }
void CuDlgMain::CheckInputParam(int nParam) { CComboBoxEx* pComboNode = (nParam == 1)? &m_cComboNode1: &m_cComboNode2; CComboBoxEx* pComboDatabase = (nParam == 1)? &m_cComboDatabase1: &m_cComboDatabase2; CComboBoxEx* pComboUser = (nParam == 1)? &m_cComboUser1: &m_cComboUser2; CEdit* pEdit = (nParam == 1)? &m_cEditFile1: &m_cEditFile2; if (pComboNode->IsWindowVisible() && pComboDatabase->IsWindowVisible() && pComboUser->IsWindowVisible()) { int nSel = pComboNode->GetCurSel(); if (nSel == CB_ERR) throw (int)1; CaNode* pNode = (CaNode*)pComboNode->GetItemDataPtr(nSel); if (!pNode) throw (int)1; nSel = pComboDatabase->GetCurSel(); if (nSel == CB_ERR) throw (int)2; CaDatabase* pDatabase = (CaDatabase*)pComboDatabase->GetItemDataPtr(nSel); if (!pDatabase) throw (int)2; nSel = pComboUser->GetCurSel(); if (nSel == CB_ERR) throw (int)3; CaUser* pUser = (CaUser*)pComboUser->GetItemDataPtr(nSel); if (!pUser) throw (int)3; } else { CString strFile; pEdit->GetWindowText(strFile); strFile.TrimLeft(); strFile.TrimRight(); if (strFile.IsEmpty()) throw (int)3; if (_taccess(strFile, 0) == -1) throw (int)4; } }