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

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


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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20180201/614efafb/attachment.html>


More information about the gme-users mailing list