[gme-users] modeless dialog box

Peter Volgyesi peter.volgyesi at vanderbilt.edu
Thu Jul 1 16:50:31 CDT 2004


Hi,


1., Add a new dispatch wrapper class to your BON2 project:
    a., Invoke the Class Wizard (CTRL-W)
    b., Click on Add Class... and select From a Type Library...
    c., In the file chooser select the GME.exe file 
    e., In the next dialog select IGMEOLEApp (The other default settings are
OK, or you can choose custom class and file names), click OK and close the
Class Wizard (OK)
2., Include the generated GME.h in your BON2Component.cpp
3., Insert the following code snippet into Component::invokeEx() or
whereever you want:
	
	Folder root = project->getRootFolder();
	ASSERT(root);
	std::set<FCO> rootFCOs = root->getRootFCOs();
	FCO firstFCO = *rootFCOs.begin();
	CComPtr<IMgaFCO> mgaFCO = firstFCO->getFCOI(); // Modify this line
to show other object
	CComPtr<IMgaProject> mgaProject = project->getProjectI();
	ASSERT(mgaProject);

	CComPtr<IMgaClient> gmeClient;
	CComBSTR gmeName("GME.Application");
	COMTHROW( mgaProject->GetClientByName(gmeName, &gmeClient) );
	ASSERT(gmeClient);

	CComPtr<IDispatch> gmeDispatch;
	COMTHROW( gmeClient->get_OLEServer(&gmeDispatch) );
	
	IGMEOLEApp gmeApp(gmeDispatch);

	CComPtr<IMgaTerritory> terr;
	COMTHROW( mgaProject->get_ActiveTerritory(&terr));
	ASSERT(terr);
	COMTHROW( mgaProject->CommitTransaction() );

	gmeApp.ShowFCO(mgaFCO);
	
	COMTHROW( mgaProject->BeginTransaction(terr) );

--
peter



> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu 
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
> Of Rajesh Sudarsan
> Sent: Friday, June 25, 2004 12:22 AM
> To: 'A list for GME users to share thoughts and discuss bugs 
> and fixes.'
> Subject: RE: [gme-users] modeless dialog box
> 
> Hi Peter,
> Thanks for the reply. I have one other question. In the Find 
> utility in GME, when you double click on the results, the 
> corresponding component opens up. Is it possible to implement 
> the same feature from a plug-in using BON?
> 
> Regards,
> Rajesh
> 
> -----Original Message-----
> From: gme-users-bounces at list.isis.vanderbilt.edu
> [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf 
> Of Peter Volgyesi
> Sent: Thursday, June 24, 2004 3:11 AM
> To: 'A list for GME users to share thoughts and discuss bugs 
> and fixes.'
> Subject: RE: [gme-users] modeless dialog box
> 
> Generally, it is not recommended to create a non-modal dialog 
> box in your
> component:
> - in a plug-in or in an interpreter it is prohibited to 
> create such a window because of the general flow of control 
> in such components. After returning from your component 
> (InvokeEx() returns) there should be no interpreter windows 
> lingering around.
> - you might create a modeless window in an BON2 add-on, but I 
> don't have too much experience with this
> 
> The second part of your question is not GME releated but a general MFC
> issue:
> http://www.codeproject.com/dialog/gettingmodeless.asp
> 
> --
> peter
> 
> 
> > -----Original Message-----
> > From: gme-users-bounces at list.isis.vanderbilt.edu
> > [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of 
> > Rajesh Sudarsan
> > Sent: Thursday, June 24, 2004 1:41 AM
> > To: 'A list for GME users to share thoughts and discuss bugs and 
> > fixes.'
> > Subject: [gme-users] modeless dialog box
> > 
> > 
> > Hi,
> > Is it possible to create a modeless MFC dialog box using a plug-in 
> > written in BON? I am not able to instantiate a MFC dialog box as a 
> > modeless window. The only way I can instantiate it is using 
> DoModal() 
> > method.
> > 
> > Regards,
> > Rajesh
> > 
> > _______________________________________________
> > gme-users mailing list
> > gme-users at list.isis.vanderbilt.edu
> > http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
> 
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users



More information about the gme-users mailing list