Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Problem with document windows in Proe

apilikov

New member
Hi All
I have a problem. I want somebody who knows toolkit well to advise me something to do.


in toolkit there are several functions to close the document and its window ProWindowCurrentSet() ProWindowCurrentClose() ProMdlEraseAll().
toolkit offers you to use them to close part assembly drawing or something else having window.
here is an example code
ProError MdlClose(ProMdl pMdl,bool bErase=true)
{
ProError eError;
int nWindowId=0;
if(MdlVisibleGet(pMdl,nWindowId))
{
eError=ProWindowCurrentSet(nWindowId);
eError=ProWindowCurrentClose();
}
if(bErase)
{
eError=ProMdlEraseAll(pMdl);
return eError;
}
return PRO_TK_NO_ERROR;
}
and now the problem. Standard situation: I need to close the document. .. OK let's call this function..eError always equals PRO_TK_NO_ERROR but there one moment.proe in spite of MdlClose function call DOES NOT CLOSE THE WINDOW immediately. I must to do something with it... to click on it or try to activate. It is not pretty to do this programmatically through WIN32 API: I must find the window, then try to simulate its activation and stop these operations when needed. It's uneasy to make this code work good or may be impossible.
and now the main problem. I have no objection to hanging windows after close commands given to protoolkit. the main problem is that proe does not allow you toload the document with the same name in session and also to create the window for it until the closed and "dead" window disappear. And I've broken out my head to resolve the problem.


Have you got some considerations&
smiley19.gif
 
apilikov,


To get a clear understanding on how to manipulate Pro/ENGINEER windows with Pro/TOOLKIT I would read the API Wizard under User's Guide->Graphics and Object Display->Manipulating Windows->Creating and Removing Windows. I would not make the window current to close it. I would instead call ProWindowDelete.
 
williaps said:
apilikov,


To get a clear understanding on how to manipulate Pro/ENGINEER windows with Pro/TOOLKIT I would read the API Wizard under User's Guide->Graphics and Object Display->Manipulating Windows->Creating and Removing Windows. I would not make the window current to close it. I would instead call ProWindowDelete.


using ProWindowDelete has the same result. Until I manually select the deleted window it remains on task bar and in proe brains. ((((((
 
apilikov,


If it is possible can you reproduce your issue in a very small program? Or could you send the code snippet where the problem occurs. The location in the documentation that I sent you explains how to manipulate windows. If you are not following those guidelines then I think you may have to change your code.
 
williaps,


here is the function


ProError TestFunction(ProMdl pMdl,bool bErase=true)//function I created to show the problem
{
ProError eError;
int nWindowId=0;
CString s=GetMdlFullName(pMdl);//function getting full mdl name
CString s1=GetPath(s);//retrieving path
CString s2=GetFileName(s);//retrieving filename
if(MdlVisibleGet(pMdl,nWindowId))
{
eError=ProWindowCurrentSet(nWindowId);
eError=ProWindowCurrentClose();
}
if(bErase)
{
eError=ProMdlEraseAll(pMdl);
return eError;
}
//and if I now try to retrieve this model again it will fail with it.
ProPath wPath;
ConvertFromCStringToWChar(s1,wPath);//converting from CString to native wchar_t*
eError=ProDirectoryChange(s);
ProName wName;
ConvertFromCStringToWChar(s2,wName);//converting from CString to native wchar_t*
ProMdl pMdl=0;
eError=ProMdlRetrieve(wName,PRO_MDL_PART,&pMdl);// this operation will fail because model window have not yet deleted.
//it is necessary to manualy click it or activate to remind proe to delete it and the model
return PRO_TK_NO_ERROR;
}
 

Sponsor

Back
Top