Click here to Skip to main content
15,906,455 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralComponent oriented application Pin
Jerome Conus31-Jul-03 3:25
Jerome Conus31-Jul-03 3:25 
GeneralRe: Component oriented application Pin
armentage31-Jul-03 4:00
armentage31-Jul-03 4:00 
GeneralRe: Component oriented application Pin
Jim Crafton31-Jul-03 8:06
Jim Crafton31-Jul-03 8:06 
GeneralMFC Tree View Pin
rahulmsaxena31-Jul-03 3:24
rahulmsaxena31-Jul-03 3:24 
GeneralRe: MFC Tree View Pin
Tim Ranker31-Jul-03 3:39
Tim Ranker31-Jul-03 3:39 
GeneralRe: MFC Tree View Pin
rahulmsaxena31-Jul-03 3:51
rahulmsaxena31-Jul-03 3:51 
GeneralRe: MFC Tree View Pin
Tim Ranker31-Jul-03 4:54
Tim Ranker31-Jul-03 4:54 
GeneralRe: MFC Tree View Pin
rahulmsaxena31-Jul-03 9:20
rahulmsaxena31-Jul-03 9:20 
hi Tim,
Thanks for the snippet, I am doing as you have suggested,I have created the function

OnSelChange(NMHDR *pNMHDR,LRESULT *pResult)
{

NM_TREEVIEW *pNMTREEVIEW = (NM_TREEVIEW*) pNMHDR;
CTreeCtrl &tree = GetTreeCtrl(); // Get the Tree Control reference

HTREEITEM hItem = tree.GetSelectedItem();// Get the currently selected item
*temp = tree.GetItemData(hItem); // Get the item value in this case 1,2,3.. I suppose

CString item_data = temp;

CTree1_ExampleDoc * pDoc = GetDocument(); // Get hold of the document

// Get the children of the selected item and update the document object!
for(int i=0;i<num_array.getsize();++i)
{
="" numbers="" num;="" refer="" below="" for="" the="" number="" defn.
="" cstring="" sfulllist;
="" num="Num_array.GetAt(i);
" if(item_data="Num.index)
" pdoc-="">Doc_Number.index= item_data;
for(int k=0;k<num.child.getsize();++k)
{
="" pdoc-="">Doc_Number.Child.Add(Num.Child.GetAt(k));
sFullList =sFullList+Num.Child.GetAt(k)+"\r\n";
}
break;
}
}


GetDocument()->SetModifiedFlag();
GetDocument()->UpdateAllViews(this,1L,(CObject*) &sFullList);
}

In the EditView Class there is a function OnUpdate listed below,for which I am retrieving the updated document object.

void CTree1_ExampleView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)
{
// TODO: Add your specialized code here and/or call the base class

if(lHint==1L)
{
CEdit & theEdit = GetEditCtrl();


// sFullList = ((CString*)pHint)->GetBuffer(0);

CTree1_ExampleDoc *pDoc = GetDocument();

Numbers View_Number;
View_Number.index = pDoc->Doc_Number.index;
CString sFullList;

for(int i=0;i<pdoc->Doc_Number.Child.GetSize();++i)
{
View_Number.Child.Add(pDoc->Doc_Number.Child.GetAt(i));

sFullList = sFullList+pDoc->Doc_Number.Child.GetAt(i)+ "\r\n";
}

// AfxMessageBox(sFullList);
theEdit.SetWindowText(sFullList);

this->Invalidate();
}


}

This however is not displaying the text in the edit window.
// Definition for Numbers


class Numbers
{
public:
CString index;
CString sub_index;

CStringArray Child;

Numbers& operator=(Numbers &num)
{
index = num.index;
sub_index = num.sub_index;
Child.Copy(num.Child);
return *this;
}
};

class Numbers_Array:public CArray<numbers,numbers&>,Numbers
{

};

Last question, How do I get the item currently selected by the mouse, Will I have to write a message handler such as OnMouseClick(); ???
Please suggest.

thanks
rahul
GeneralRe: MFC Tree View Pin
Tim Ranker31-Jul-03 10:16
Tim Ranker31-Jul-03 10:16 
GeneralHowto: get a Two's Complement Checksum Pin
DudleyDoorite31-Jul-03 2:43
DudleyDoorite31-Jul-03 2:43 
GeneralRe: Howto: get a Two's Complement Checksum Pin
Ryan Binns31-Jul-03 3:19
Ryan Binns31-Jul-03 3:19 
GeneralRe: Howto: get a Two's Complement Checksum Pin
Tim Ranker31-Jul-03 3:31
Tim Ranker31-Jul-03 3:31 
GeneralRe: Howto: get a Two's Complement Checksum Pin
DudleyDoorite31-Jul-03 3:43
DudleyDoorite31-Jul-03 3:43 
GeneralExtracting Audio from AVI Pin
Anonymous31-Jul-03 2:22
Anonymous31-Jul-03 2:22 
GeneralRe: Extracting Audio from AVI Pin
Jim Crafton31-Jul-03 8:07
Jim Crafton31-Jul-03 8:07 
Generallaser pointer interaction Pin
sleep223131-Jul-03 1:34
sleep223131-Jul-03 1:34 
GeneralRe: laser pointer interaction Pin
Alexander M.,31-Jul-03 10:40
Alexander M.,31-Jul-03 10:40 
General_beginthread newbie question Pin
tareqsiraj31-Jul-03 1:24
tareqsiraj31-Jul-03 1:24 
GeneralRe: _beginthread newbie question Pin
Rage31-Jul-03 1:32
professionalRage31-Jul-03 1:32 
GeneralRe: _beginthread newbie question Pin
Renjith Ramachandran31-Jul-03 1:42
Renjith Ramachandran31-Jul-03 1:42 
GeneralRe: _beginthread newbie question Pin
tareqsiraj31-Jul-03 1:50
tareqsiraj31-Jul-03 1:50 
GeneralRe: _beginthread newbie question Pin
Jim Crafton31-Jul-03 8:11
Jim Crafton31-Jul-03 8:11 
GeneralRe: _beginthread newbie question Pin
User 665831-Jul-03 2:11
User 665831-Jul-03 2:11 
GeneralRe: _beginthread newbie question Pin
Vitali Halershtein31-Jul-03 4:55
Vitali Halershtein31-Jul-03 4:55 
GeneralRe: _beginthread newbie question Pin
tareqsiraj31-Jul-03 6:53
tareqsiraj31-Jul-03 6:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.