Click here to Skip to main content
15,888,521 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Visual C++ 6.0 Release, but cannot get original Source Code Pin
Michael Hinton23-May-19 7:12
Michael Hinton23-May-19 7:12 
QuestionAdd tool tip to menu Pin
NoviceEx17-May-19 1:28
NoviceEx17-May-19 1:28 
AnswerRe: Add tool tip to menu Pin
Richard MacCutchan17-May-19 3:30
mveRichard MacCutchan17-May-19 3:30 
SuggestionRe: Add tool tip to menu Pin
David Crow17-May-19 3:38
David Crow17-May-19 3:38 
AnswerRe: Add tool tip to menu Pin
leon de boer17-May-19 4:30
leon de boer17-May-19 4:30 
AnswerRe: Add tool tip to menu Pin
NoviceEx20-May-19 0:57
NoviceEx20-May-19 0:57 
GeneralRe: Add tool tip to menu Pin
phil.o20-May-19 1:04
professionalphil.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
tianzhili439915-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
mveRichard 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
David 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
tianzhili439915-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
David 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
tianzhili439915-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
mveRichard 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
tianzhili439916-May-19 0:06 
Questionsolved Linking "foreign" library - not build on running system ? Pin
Vaclav_12-May-19 17:46
Vaclav_12-May-19 17:46 
AnswerRe: Linking "foreign" library - not build on running system ? Pin
Richard MacCutchan12-May-19 21:19
mveRichard MacCutchan12-May-19 21:19 
QuestionC++, java Pin
Benjamin Apire9-May-19 10:47
Benjamin Apire9-May-19 10:47 
QuestionRe: C++, java Pin
David Crow9-May-19 17:10
David 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
mveRichard MacCutchan9-May-19 21:38 
QuestionAnalyzing make error output - one problem solved.... Pin
Vaclav_8-May-19 6:38
Vaclav_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
Vaclav_8-May-19 8:08 
GeneralRe: Analyzing make error output Pin
Vaclav_8-May-19 17:05
Vaclav_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.