[gme-users] Could someone please post an example for creating a window/dialog within an BON2 addon?

Kevin Smyth ksmyth at isis.vanderbilt.edu
Fri Dec 5 08:37:48 CST 2014


While I don't think it addresses your issue, the code in that link 
should read:

Folder root = project->getRootFolder();
ASSERT(root);
std::set<FCO> rootFCOs = root->getRootFCOs();
FCO firstFCO = *rootFCOs.begin();
CComPtr<IMgaFCO> mgaFCO = firstFCO->getFCOI().p; // Modify this line to 
show other object
CComPtr<IMgaProject> mgaProject = project->getProjectI().p;
ASSERT(mgaProject);

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

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

CComQIPtr<IGMEOLEApp> gmeApp(gmeDispatch);

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

gmeApp->ShowFCO(mgaFCO);

COMTHROW( mgaProject->BeginTransaction(terr) );



Showing a dialog is not specific to GME, but here is how to do it:
First create a dialog by right-clicking on the project, and selecting 
Class Wizard.... Hit Add Class. Fill out the name, and select CDialog as 
the base class.

Then you can show the dialog by including resource.h and MyDialog.h, 
then inserting this code:
CMyDialog dlg;
dlg.DoModal();

Kevin


On 12/4/2014 7:35 PM, Sanjib Das wrote:
> Dear Concern,
>
> I am using the latest version of GME (GME-14.10.29). And trying to 
> develop addon using source (GME-14.10.29_src) on MSVS2010.
>
> *Can someone please post an working example for creating a 
> window/dialog/ popup on BON2 addon ?*
>
>
> Though there are few example found about modeless dialog box , such as
> http://list.isis.vanderbilt.edu/pipermail/gme-users/2004-July/000502.html
>
> Unfortunately after following the instruction I ended up with errors 
> as bellow:
>
> CComPtr<IMgaFCO> mgaFCO = firstFCO->getFCOI();  is returning ::
>
>     1    IntelliSense: more than one user-defined conversion from 
> "BON::FCOPtr" to "ATL::CComPtr<IMgaFCO>" applies: 
> d:\hiwi\bon2component123\bon2component123\bon2component.cpp 106
>
>
> CComPtr<IMgaProject> mgaProject = project->getProjectI(); returns::
>
> "    2    IntelliSense: more than one user-defined conversion from 
> "BON::ProjectPtr" to "ATL::CComPtr<IMgaProject>" applies: 
> d:\hiwi\bon2component123\bon2component123\bon2component.cpp 107
> "
> And
>
> IGMEOLEApp gmeApp(gmeDispatch);
> "    3    IntelliSense: object of abstract class type "IGMEOLEApp" is 
> not allowed: 
> d:\hiwi\bon2component123\bon2component123\bon2component.cpp 118
> "
>
>
> I will be looking forward to have a response.
>
> Thankfully
>
> Sanjib Das
> University of Stuttgart
> Institut für Luftfahrtsysteme
>
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20141205/25c27935/attachment.html 


More information about the gme-users mailing list