[gme-users] Add-on : how to visually mark a node programatically
Kevin Smyth
ksmyth at isis.vanderbilt.edu
Mon Feb 28 11:32:49 CST 2011
Here's code to select an FCO in the Model Editor, and in the Tree Browser:
CBuilder &builder;
Project& project;
FCO& currentFCO;
project->commitOnly();
// Selects an FCO in the model editor
// GetClientByName fails if the component is invoked outside of GME
// ShowFCO fails if the FCO doesn't have a model parent
CComBSTR app("GME.Application");
CComPtr<IMgaClient> client;
ProjectPtr proj = project->getProjectI();
COMTHROW(proj->GetClientByName((BSTR)app, &client));
CComPtr<IDispatch> gui;
COMTHROW(client->get_OLEServer(&gui));
CComPtr<IGMEOLEApp> oleapp;
COMTHROW(gui.QueryInterface(&oleapp));
oleapp->ShowFCO(currentFCO->getFCOI(), VARIANT_TRUE);
// Select an FCO in the Tree Browser:
CComPtr<IGMEOLEColl> oleColl;
oleapp->get_Panels(&oleColl);
long count;
COMTHROW(oleColl->get_Count(&count));
for (long i = 1; i <= count; i++) {
CComPtr<IDispatch> d;
COMTHROW(oleColl->get_Item(i, &d));
CComQIPtr<IGMEOLEPanel> panel;
panel = d;
CComBSTR name;
panel->get_Name(&name);
if (name != L"Browser") {
continue;
}
CComPtr<IDispatch> browser;
COMTHROW(panel->get_Interface(&browser));
CComDispatchDriver driver(browser);
DISPID dispid;
COMTHROW(driver.GetIDOfName(L"FocusItem", &dispid));
project->beginOnly();
std::string id = currentFCO->getID();
project->commitOnly();
CComVariant vId(id.c_str());
COMTHROW(driver.Invoke1(dispid, &vId));
}
project->beginOnly();
Kevin
-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Dan Simkins
Sent: Monday, February 28, 2011 10:18 AM
To: gme-users
Subject: Re: [gme-users] Add-on : how to visually mark a node
programatically
Hi Akos,
Thanks for your response ... is this available in the BON/BON2 packages
... I am struggling to find the right method.
Kind regards
Dan
On 28/02/2011 16:11, Akos Ledeczi wrote:
> You can also select a node programatically via the GME COM interface as
> if the user click on it.
>
> On 2/28/2011 10:03 AM, James H. Hill wrote:
>> Hi Dan,
>>
>> On Feb 28, 2011, at 10:58 AM, Dan Simkins wrote:
>>
>>> Dear All,
>>>
>>> I am writing a Add-on and wish to visually mark a node somehow, e.g.
>>> under specific conditions, highlight a node on the diagram. Is this
>>> possible to do programatically ? Any help or assistance or pointers to
>>> documentation that would help, would be great.
>>>
>> This is possible using a GME decorator.
>>
>> HTH,
>>
>> James
>>
>>> Many thanks and kind regards
>>>
>>> D
>>> _______________________________________________
>>> 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
--
Dan Simkins
dan.simkins at workflow-science.com
+44 (0) 7976 979 656
This email and any attachments to it may be confidential and are intended
solely for the use of the individual to whom it is addressed. Any views or
opinions expressed are solely those of the author and do not necessarily
represent those of Workflow Science Ltd.
If you are not the intended recipient of this email, you must neither take
any action based upon its contents, nor copy or show it to anyone.
Please contact the sender if you believe you have received this email in
error.
Workflow Science Ltd, registered in England and Wales, Company Number
04248591
_______________________________________________
gme-users mailing list
gme-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4934 bytes
Desc: not available
Url : http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20110228/d011fd19/attachment.bin
More information about the gme-users
mailing list