void CAttributeLinkTableDialog::OnOK() { SaveTarget(m_TargetCombo); //smaz vsecky link elementy MSXML2::IXMLDOMSelectionPtr sel = m_SelXMLElm->selectNodes("link"); sel->removeAll(); sel.Release(); //vytvor vzorovy element MSXML2::IXMLDOMElementPtr link_elenet = m_SelXMLElm->ownerDocument->createElement("link"); link_elenet->setAttributeNode(m_SelXMLElm->ownerDocument->createAttribute("attr_name")); link_elenet->setAttributeNode(m_SelXMLElm->ownerDocument->createAttribute("caption")); //pridej elementy podle listu for (int a=0; a < m_CaptionsList.GetItemCount(); a++) { link_elenet->setAttribute("attr_name", (LPCTSTR) m_CaptionsList.GetItemText(a, CAPTLIST_CL_NAME)); link_elenet->setAttribute("caption", (LPCTSTR) m_CaptionsList.GetItemText(a, CAPTLIST_CL_CAPTION)); m_SelXMLElm->appendChild(link_elenet->cloneNode(VARIANT_FALSE)); } link_elenet.Release(); //uloz style CString style_str; m_StyleCombo.GetWindowText(style_str); m_SelXMLElm->setAttribute("style", (LPCTSTR) style_str); CDialog::OnOK(); }
void Prey::FollowLeader() { if (LeaderInRange()) { Wander(); } else { // cout<<"Leader is out of range"<<endl; SaveTarget(); ChaseMode(); SetFollowerState(FS_CHASELEADER); } }
void CAttributeLinkDialog::OnOK() { CString s; //Id - saved after the close of the dialog in class CSkeletonDoc //target SaveTarget(m_TargetCombo); //attr name POSITION pos = m_AttributesList.GetFirstSelectedItemPosition(); if (pos != NULL) { int nItem = m_AttributesList.GetNextSelectedItem(pos); s = * (CString*) m_AttributesList.GetItemData(nItem); } m_SelXMLElm->setAttribute("attr_name", (LPCTSTR) s); //style //vymaz attribut style z tagu if (m_SelXMLElm->attributes->getNamedItem("style") != NULL) { m_SelXMLElm->attributes->removeNamedItem("style"); } CString style_str; m_StylesCombo.GetWindowText(style_str); if (style_str.GetLength() != 0) { MSXML2::IXMLDOMAttributePtr s_atr = m_SelXMLElm->ownerDocument->createAttribute("style"); s_atr->text = (LPCTSTR) style_str; m_SelXMLElm->setAttributeNode(s_atr); s_atr.Release(); } CDialog::OnOK(); }