[gme-users] About Programatically Set Selection to an Object in GME

Somesh Das somesh_au at yahoo.com
Thu Oct 26 04:22:44 CDT 2017

Hi Kevin,I tried the code you suggested as follows :CString    result ("<a href = \" javascript: ");
 result + = "gme.MgaProject.BeginTransactionInNewTerr (); gme.ShowFCO (gme.MgaProject.GetFCOByID (";
 result + = objectId; // id of the object
 result + = "), true); gme.MgaProject.CommitTransaction ();";
 result + = "\"> ";
 result + = text; // name of the object result + = "</a>";But in GME when I click on the hyperlink its showing a script error. I attached the screen shot of the error. Please let me know if I am doing any mistake. Thanks & Regards 
Somesh Das


    On Monday, October 23, 2017 8:27 PM, Kevin Smyth <kevin.m.smyth at gmail.com> wrote:

 1. You want the ShowFCO method on the GME interface (IGMEOleIt):[helpstring("ShowFCO - accepts relative path both up and down. For models only: If InParent == true shown selected in parent, otherwise opened.")]HRESULT ShowFCO( [in] BSTR path, [in, defaultvalue(0)] VARIANT_BOOL inParent );
You can get the GME interface from the project:
project->GetClientByName(_bstr_t(L"GME.Application"), &client)

2.Yes, that's what the hyperlinks do. You could try writing a link like <a href="javascript:gme.MgaProject.BeginTransactionInNewTerr(); gme.ShowFCO(gme.MgaProject.GetFCOByID("id-0065-000011"), true); gme.MgaProject.CommitTransaction()">model</a>(I haven't tested this code. You may need to call ShowFCO outside the transaction)

On Mon, Oct 23, 2017 at 4:54 AM, Somesh Das <somesh_au at yahoo.com> wrote:

Hi,I am developing an interpreter for GME which will find out all objects connected with selected objects.For this purpose I need set selection on a set of objects in GME. I tried to get the default decorator for GME and tried the following code
HRESULT hres = decorator.CoCreateInstance(L" MGA.BoxDecorator" );decorator->Initialize(project- >getProjectI(), NULL,fco (intended fco));decorator->SetSelected(value); However this code is not working.
Actually my intention is to make a hyperlink of all connected fco. If user clicks on the hyperlink then corresponding fco will be shown up and tried the following code
Console::Out::WriteLine( CString("-> Source: ") + Formatter:: MakeObjectHyperlink(CString( namePath.c_str()), CString(connEnd->getID().c_ str())));

For Atom this code is working but if the connected fco is model then if select the hyperlink then its going inside the model which is not my intend. I want to make selection only.
Please can anybody suggest me how to make a selection on an object Programatically.
Thanks & Regards
Somesh Das

______________________________ _________________
gme-users mailing list
gme-users at list.isis. vanderbilt.edu
http://list.isis.vanderbilt. edu/cgi-bin/mailman/listinfo/ gme-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20171026/8063abaa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Error.jpg
Type: image/jpeg
Size: 144658 bytes
Desc: not available
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20171026/8063abaa/attachment.jpg>

More information about the gme-users mailing list