您是否会告诉我如何在单击左窗格的树控件时在右窗格编辑控件中显示数据。 [英] Will u plz tell me how to display the data in the right pane edit control the moment when you click on the tree control of left pane.
本文介绍了您是否会告诉我如何在单击左窗格的树控件时在右窗格编辑控件中显示数据。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法获得完美的代码来添加
void CFormLeft :: OnSelchangedTree1(NMHDR * pNMHDR,LRESULT * pResult)
{
}
以上函数我已经将事件处理程序添加到左窗格树cntrl中,现在你将告诉我从左到右打印数据的完美代码。
我尝试过:
//在主框架中
BOOL CMainFrame :: OnCreateClient(LPCREATESTRUCT lpcs,CCreateContext * pContext)
{
// TODO:在这里添加你的专门代码和/或调用基类
if (!m_wndSplitter.CreateStatic(this,1,2))
返回FALSE;
if(!m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CFormLeft),CSize(125,100),pContext)||
!m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CFormRight),CSize (100,100),pContext))
{
m_wndSplitter.DestroyWindow();
返回FALSE;
}
((CFormLeft *)m_wndSplitter.GetPane(0,0)) - > SetTarget(m_wndSplitter.GetPane(0,1));
返回TRUE;
}
//在左框架中
void CFormLeft :: SetTarget(CWnd * m_cwnd)
{
m_target = m_cwnd;
}
BOOL CFormLeft :: OnCommand(WPARAM wParam,LPARAM lParam)
{
// TODO:在这里添加你的专门代码和/或调用基类
if(m_target)
{
m_target-> SendMessage(WM_COMMAND,wParam,lParam);
}
else
{
CFormView :: OnCommand(wParam,lParam);
}
返回true;
//返回CFormView :: OnCommand(wParam,lParam);
}
void CFormLeft :: OnInitialUpdate()
{
CFormView :: OnInitialUpdate();
HTREEITEM hParent = m_TreeCtrl.InsertItem(LSTUDENT DETAILS,TVI_ROOT);
HTREEITEM hChild = m_TreeCtrl.InsertItem(LSTUDETN1,hParent,TVI_LAST);
HTREEITEM hChild1 = m_TreeCtrl.InsertItem(LSTUDETN2,hParent,TVI_LAST);
HTREEITEM hChild2 = m_TreeCtrl.InsertItem(LSTUDETN3,hParent,TVI_LAST);
HTREEITEM hChild3 = m_TreeCtrl.InsertItem(LSTUDETN4,hParent,TVI_LAST);
HTREEITEM hChild4 = m_TreeCtrl.InsertItem(LSTUDETN5,hParent,TVI_LAST);
}
无效CFormLeft :: OnSelchangedTree1(NMHDR * pNMHDR,LRESULT * pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast< LPNMTREEVIEW>(pNMHDR);
// TODO:在这里添加您的控制通知处理程序代码
* pResult = 0;
}
//这些是我已经采取的变量
CTreeCtrl m_TreeCtrl;
afx_msg void OnSelchangedTree1(NMHDR * pNMHDR,LRESULT * pResult)
CTreeCtrl m_MFC_Tree;
解决方案
您在当你点击左窗格树控件时,如何在右窗格的编辑框中显示数据[ ^ ]。
i cant get the perfect code to add an
void CFormLeft::OnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult)
{
}
for above function I have added the event handler to the left pane tree cntrl,now will u plz tell me the perfect code to print the data from left to right.
What I have tried:
//in MAIN FRAME
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // TODO: Add your specialized code here and/or call the base class if (!m_wndSplitter.CreateStatic(this, 1, 2)) return FALSE; if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CFormLeft), CSize(125, 100), pContext) || !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CFormRight), CSize(100, 100), pContext)) { m_wndSplitter.DestroyWindow(); return FALSE; } ((CFormLeft*)m_wndSplitter.GetPane(0, 0))->SetTarget(m_wndSplitter.GetPane(0, 1)); return TRUE; }
//in LEFT FRAME
void CFormLeft::SetTarget(CWnd* m_cwnd) { m_target = m_cwnd; } BOOL CFormLeft::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class if (m_target) { m_target->SendMessage(WM_COMMAND, wParam, lParam); } else { CFormView::OnCommand(wParam, lParam); } return true; //return CFormView::OnCommand(wParam, lParam); }
void CFormLeft::OnInitialUpdate() { CFormView::OnInitialUpdate(); HTREEITEM hParent = m_TreeCtrl.InsertItem(L"STUDENT DETAILS", TVI_ROOT); HTREEITEM hChild = m_TreeCtrl.InsertItem(L"STUDETN1", hParent, TVI_LAST); HTREEITEM hChild1 = m_TreeCtrl.InsertItem(L"STUDETN2", hParent, TVI_LAST); HTREEITEM hChild2 = m_TreeCtrl.InsertItem(L"STUDETN3", hParent, TVI_LAST); HTREEITEM hChild3 = m_TreeCtrl.InsertItem(L"STUDETN4", hParent, TVI_LAST); HTREEITEM hChild4 = m_TreeCtrl.InsertItem(L"STUDETN5", hParent, TVI_LAST); } void CFormLeft::OnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult) { LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR); // TODO: Add your control notification handler code here *pResult = 0; }
//these are the variables I have taken
CTreeCtrl m_TreeCtrl; afx_msg void OnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult)
CTreeCtrl m_MFC_Tree;
解决方案
You were given the answer at How to display the data in edit box of right pane when u click on the left pane tree control[^].
这篇关于您是否会告诉我如何在单击左窗格的树控件时在右窗格编辑控件中显示数据。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文