Click here to Skip to main content
14,176,451 members

C / C++ / MFC

 
GeneralRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
Michael Hinton23-May-19 7:12
memberMichael Hinton23-May-19 7:12 
QuestionAdd tool tip to menu Pin
NoviceEx17-May-19 1:28
memberNoviceEx17-May-19 1:28 
AnswerRe: Add tool tip to menu Pin
Richard MacCutchan17-May-19 3:30
protectorRichard MacCutchan17-May-19 3:30 
SuggestionRe: Add tool tip to menu Pin
David Crow17-May-19 3:38
memberDavid Crow17-May-19 3:38 
AnswerRe: Add tool tip to menu Pin
leon de boer17-May-19 4:30
memberleon de boer17-May-19 4:30 
AnswerRe: Add tool tip to menu Pin
NoviceEx20-May-19 0:57
memberNoviceEx20-May-19 0:57 
GeneralRe: Add tool tip to menu Pin
phil.o20-May-19 1:04
mvephil.o20-May-19 1:04 
QuestionHow to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 3:52
membertianzhili439915-May-19 3:52 
The function I need to implement is to first select a row in the ListControl, and then press the "Import" button, the program will import the file corresponding to the pre-set corresponding path of this row.

I have written an import function, just need to provide the path and name corresponding to the file you want to import.

The problem is that I don't know how to match the selected line with the pre-set path and file, because there are too many files and paths (at least 20) to be set in advance, and listcontrol has the same number of lines and files as the number of files.

The point of my problem is that I don't know how to get the number of any selected row to associate it with the corresponding path and file.

All I know is to associate any row selected by the ListControl with only one of the specified paths and files.

Here are my codes:
void RobotmodelPre::OnBnClickedInputmodel()
{
	
	CDocTemplate* pDocTempl;
	POSITION pos=AfxGetApp()->GetFirstDocTemplatePosition();
	pDocTempl=AfxGetApp()->GetNextDocTemplate(pos);
	POSITION posDoc=pDocTempl->GetFirstDocPosition();
	if (posDoc!=NULL)
	{
		m_pDoc=(CRobotAppDoc*)pDocTempl->GetNextDoc(posDoc);	
	} 
	else
	{
		m_pDoc=NULL;
		AfxMessageBox("FAIL!");
		return;
	}

	CString filePath1 = "D:\\robot_new\\Data\\4kg_simplified\\SR4_SIASUN.rbt";
	CString folderPath1 ="D:\\robot_new\\Data\\4kg_simplified";

	CWaitCursor	cur;
	XObject obj;
	bool bIsRobotLoad = false, bIsObjectLoad = false, bIsWorkPieceLoad = false, blsToolLoad = false;
	int iObjSize = m_pDoc->m_vObj.size();
	int iRobot = -1, iObj = -1;
	CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
	if( m_pDoc->LoadRbt(filePath1,folderPath1))
			{
				bIsRobotLoad = true;
				iRobot=  m_pDoc->m_vRobot.size()-1;
				pMainFrame->m_wndModelTreeView.DisplayRobotTree();
			}
		

}


Among them, the "LoadRbt" function only needs to provide two parameters.
The debugging result of this code is that no matter which line is selected, the same file will be imported (the rbt file is a file I customize).
How can I select different lines and import different files?
AnswerRe: How to associate a row selected by ListControl with a specified path and file Pin
Richard MacCutchan15-May-19 3:59
protectorRichard MacCutchan15-May-19 3:59 
QuestionRe: How to associate a row selected by ListControl with a specified path and file Pin
David Crow15-May-19 6:57
memberDavid Crow15-May-19 6:57 
AnswerRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 14:40
membertianzhili439915-May-19 14:40 
SuggestionRe: How to associate a row selected by ListControl with a specified path and file Pin
David Crow15-May-19 16:28
memberDavid Crow15-May-19 16:28 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439915-May-19 22:42
membertianzhili439915-May-19 22:42 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
Richard MacCutchan15-May-19 23:32
protectorRichard MacCutchan15-May-19 23:32 
GeneralRe: How to associate a row selected by ListControl with a specified path and file Pin
tianzhili439916-May-19 0:06
membertianzhili439916-May-19 0:06 
Questionsolved Linking "foreign" library - not build on running system ? Pin
Vaclav_12-May-19 17:46
memberVaclav_12-May-19 17:46 
AnswerRe: Linking "foreign" library - not build on running system ? Pin
Richard MacCutchan12-May-19 21:19
protectorRichard MacCutchan12-May-19 21:19 
QuestionC++, java Pin
Benjamin Apire9-May-19 10:47
memberBenjamin Apire9-May-19 10:47 
QuestionRe: C++, java Pin
David Crow9-May-19 17:10
memberDavid Crow9-May-19 17:10 
AnswerRe: C++, java Pin
CPallini9-May-19 21:22
mveCPallini9-May-19 21:22 
AnswerRe: C++, java Pin
Richard MacCutchan9-May-19 21:38
protectorRichard MacCutchan9-May-19 21:38 
QuestionAnalyzing make error output - one problem solved.... Pin
Vaclav_8-May-19 6:38
memberVaclav_8-May-19 6:38 
AnswerRe: Analyzing make error output Pin
CPallini8-May-19 7:42
mveCPallini8-May-19 7:42 
GeneralRe: Analyzing make error output Pin
Vaclav_8-May-19 8:08
memberVaclav_8-May-19 8:08 
GeneralRe: Analyzing make error output Pin
Vaclav_8-May-19 17:05
memberVaclav_8-May-19 17:05 

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.


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190525.1 | Last Updated 25 May 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid