[gme-users] Creating read-only attributes in a meta-model

Kevin Smyth kevin.m.smyth at gmail.com
Thu Feb 1 11:16:09 CST 2018


The third parameter should not be null if the type is OBJEVENT_ATTR and an
attribute's value has changed. (It may be null if the attribute was set to
the same value)

Kevin

On Thu, Feb 1, 2018 at 10:37 AM, Cinthya Lopez <Cinthya_K_Lopez at raytheon.com
> wrote:

> Hi Kevin,
>
>
>
> For #1, the third parameter that is passed into ObjectEvent is of type
> object. When I look at it in the debugger its value is null so casting it
> to object[] shows null as well. Am I missing something? I am working with
> GME 14.
>
>
>
> I think this would be the information I need. If I can get the
> “attibuteName” to check which attribute is being modified, I can avoid
> falling into the case where my add-on code executes again when I modify my
> “read-only” attribute on the same object.
>
>
>
> Thanks,
>
> Cinthya
>
>
>
> *From:* gme-users [mailto:gme-users-bounces at list.isis.vanderbilt.edu] *On
> Behalf Of *Kevin Smyth
> *Sent:* Thursday, February 1, 2018 8:58 AM
> *To:* A list for GME users to share thoughts and discuss bugs and fixes. <
> gme-users at list.isis.vanderbilt.edu>
> *Subject:* [External] Re: [gme-users] Creating read-only attributes in a
> meta-model
>
>
>
> Hi Cinthya,
>
>
>
> It is not possible to disable editing of an attribute through the GUI. You
> can only hide attributes from the GUI.
>
>
>
>
>
> I'd suggest:
>
> 1. Your add-on detects when the user modifies the attribute and sets the
> value back to the original value. When your addon receives OBJEVENT_ATTR in
> ObjectEvent, the third parameter contains the old value. For C#, cast it
> to object[], and you'll see {"ATTR:", "attributeName", "oldValue"}. Or
>
> 2. Look at OBJEVENT_ATTR and return E_MGA_CONSTRAINT_VIOLATION to signify
> the GME transaction should be aborted. In C#, you can do this like
>
> int E_MGA_CONSTRAINT_VIOLATION = 0x87657fff;
>
> throw new COMException("Constraint violation", E_MGA_CONSTRAINT_VIOLATION
> );
>
> 3. Create a hidden attribute in your meta-model. Your add-on sets this
> attribute and your original attribute to the same value. Then write a
> constraint that the attributes must be equal
>
>
>
> Kevin
>
>
>
> On Wed, Jan 31, 2018 at 5:22 PM, Cinthya Lopez <
> Cinthya_K_Lopez at raytheon.com> wrote:
>
> Hello,
>
>
>
> I am looking for a way to create a read-only attribute in my meta-model.
> Basically I want to be able to populate the value of my attribute through
> my add-on and it will only be informational to the user when they create
> their model.
>
>
>
> Does anyone know of a way to do this in GME?
>
>
>
> Thank you,
>
> Cinthya
>
>
> _______________________________________________
> gme-users mailing list
> gme-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/gme-users
>
>
>
> _______________________________________________
> 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/20180201/1a5e9005/attachment.html>


More information about the gme-users mailing list