Click here to Skip to main content
15,921,452 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMultiple selections in CTreeCtrl Pin
uma_kanth_k6-Sep-05 0:24
uma_kanth_k6-Sep-05 0:24 
GeneralRe: Multiple selections in CTreeCtrl Pin
prasad_som6-Sep-05 0:55
prasad_som6-Sep-05 0:55 
Questionwhat is %ld Pin
Member 21610045-Sep-05 23:52
Member 21610045-Sep-05 23:52 
AnswerRe: what is %ld Pin
toxcct5-Sep-05 23:57
toxcct5-Sep-05 23:57 
QuestionCHtmlEditView and MSHTML usage Pin
sotiris5-Sep-05 23:39
sotiris5-Sep-05 23:39 
Questiontrouble with UpdateAllViews() Pin
/*Trucker*\5-Sep-05 23:09
/*Trucker*\5-Sep-05 23:09 
AnswerRe: trouble with UpdateAllViews() Pin
MailtoGops6-Sep-05 2:30
MailtoGops6-Sep-05 2:30 
GeneralRe: trouble with UpdateAllViews() Pin
/*Trucker*\6-Sep-05 9:49
/*Trucker*\6-Sep-05 9:49 
Hi MailToGops,

Thanks for the reply. All views are created and initialized. Below is some code you requested of what I am trying to do:

in CLeftView:

GetDocument()->FileAction(&strFileName,1);

in Doc class:

void Ca1interfaceDoc::FileAction(CString* fl, int acn)<br />
{<br />
	fileName = *fl;<br />
	action = acn;<br />
<br />
	SetModifiedFlag();<br />
	UpdateAllViews(NULL);<br />
<br />
	fileCount++;<br />
}


in CTopRightView:

int CTopRightView::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
	if (CView::OnCreate(lpCreateStruct) == -1)<br />
		return -1;<br />
<br />
	//creating listview<br />
	folderContents.Create(WS_VISIBLE|WS_CHILD|WS_BORDER|<br />
						LVS_LIST|LVS_SINGLESEL,<br />
						CRect(10,10,300,180), this, <br />
						IDC_FOLDERCONTENTS);<br />
<br />
	LV_ITEM lvItem;<br />
	::memset(&lvItem, 0, sizeof(LV_ITEM));<br />
	lvItem.mask = LVIF_TEXT|LVIF_STATE;<br />
	lvItem.state = 0;<br />
	lvItem.stateMask = 0;<br />
	lvItem.pszText = "an item";<br />
	lvItem.iItem = 0;<br />
<br />
	folderContents.InsertItem(&lvItem);<br />
<br />
	return 0;<br />
}<br />
<br />
void CTopRightView::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint)<br />
{<br />
	//folderContents.DeleteAllItems();<br />
<br />
	if(GetDocument()->action == 1 /*&& !GetDocument()->fileCount*/){<br />
		LV_ITEM lvItem;<br />
		::memset(&lvItem, 0, sizeof(LV_ITEM));<br />
		lvItem.mask = LVIF_TEXT;<br />
		lvItem.pszText = GetNTS(GetDocument()->fileName);<br />
		lvItem.iItem = GetDocument()->fileCount;<br />
<br />
<br />
		if(folderContents.InsertItem(&lvItem) == -1)<br />
			folderContents.DeleteAllItems();<br />
<br />
		GetDocument()->action = 0;<br />
	}<br />
}


The reason I believe OnCreate gets called every time UpdateAllViews() runs is this:
*In CTopRightView::OnCreate() I create the list control along with a test item and add this test item.
*When I run the application I only see 2 items in the CTopRightViews's list control. The test item added in OnCreate() and the last item that was supposed to be added to the list control (many items are supposed to be added to the list control).

So it looks like every time UpdateAllViews is executed it recreates the list control with the test item and the most recent item to be added.Sniff | :^)

TraileR ParK LifE 4Ever
AnswerRe: trouble with UpdateAllViews() Pin
David Crow6-Sep-05 4:31
David Crow6-Sep-05 4:31 
GeneralRe: trouble with UpdateAllViews() Pin
/*Trucker*\6-Sep-05 9:24
/*Trucker*\6-Sep-05 9:24 
GeneralRe: trouble with UpdateAllViews() Pin
David Crow6-Sep-05 9:49
David Crow6-Sep-05 9:49 
GeneralRe: trouble with UpdateAllViews() Pin
/*Trucker*\6-Sep-05 10:00
/*Trucker*\6-Sep-05 10:00 
GeneralRe: trouble with UpdateAllViews() Pin
David Crow7-Sep-05 3:47
David Crow7-Sep-05 3:47 
QuestionHow to use CRecordset with CByteArray for storing BLOBs Pin
snprani5-Sep-05 23:08
snprani5-Sep-05 23:08 
AnswerRe: How to use CRecordset with CByteArray for storing BLOBs Pin
G Haranadh6-Sep-05 0:31
G Haranadh6-Sep-05 0:31 
Questiondelete[] can't replace delete? Pin
followait5-Sep-05 22:59
followait5-Sep-05 22:59 
AnswerRe: delete[] can't replace delete? Pin
toxcct5-Sep-05 23:03
toxcct5-Sep-05 23:03 
AnswerRe: delete[] can't replace delete? Pin
S. Senthil Kumar6-Sep-05 2:35
S. Senthil Kumar6-Sep-05 2:35 
AnswerRe: delete[] can't replace delete? Pin
Tim Smith6-Sep-05 3:55
Tim Smith6-Sep-05 3:55 
AnswerRe: delete[] can't replace delete? Pin
David Crow6-Sep-05 4:34
David Crow6-Sep-05 4:34 
GeneralRe: delete[] can't replace delete? Pin
Bob Ciora6-Sep-05 7:55
Bob Ciora6-Sep-05 7:55 
AnswerThe problem is... Pin
followait6-Sep-05 15:57
followait6-Sep-05 15:57 
GeneralRe: The problem is... Pin
David Crow7-Sep-05 4:48
David Crow7-Sep-05 4:48 
GeneralRe: The problem is... Pin
rbbhosale8-Sep-05 19:46
rbbhosale8-Sep-05 19:46 
QuestionHow to Store and retrieve Bitmap Image data from CByteArray Pin
snprani5-Sep-05 22:21
snprani5-Sep-05 22:21 

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.