[gme-users] Redraw decorator when object attribute changes

Yi Chu y.chu at sympatico.ca
Mon Mar 21 22:01:45 CST 2005


Thanks Akos and Peter. I tried putting codes in Initialize() and it works
for me! I will read the suggested document and learn more before jumping
into more coding.

Regards,
Yi
----- Original Message ----- 
From: "Akos Ledeczi" <akos.ledeczi at vanderbilt.edu>
To: "A list for GME users to share thoughts and discuss bugs and fixes."
<gme-users at list.isis.vanderbilt.edu>
Sent: Monday, March 21, 2005 12:49 PM
Subject: Re: [gme-users] Redraw decorator when object attribute changes


If I am not mistaken, a new decorator instance is created every time
there is a change in the models (e.g. attribute change), so you can put
your code in the Initialize() method, just like in the UML decorator.

Akos

Peter Volgyesi wrote:
> Hi,
>
> You can look up MGA error codes in the Mga.idl file (located in the
> Interfaces folder of your GME installation).
> "Your" error code means: E_MGA_NOT_IN_TRANSACTION ("Operation must
> execute within transaction"). The slight modification, you've made
> caused this problem: in the initalize method you will find other lines
> initating/commiting transactions. Generally, it is a bad idea to query
> to model database in the draw method anyway (it is slow)
> I highly suggest to read (at least the beginning of) the "MGA Library"
> documentation (Mga.pdf) if you're into decorator development.
> --
> Peter Volgyesi
> ISIS, Vanderbilt University
>
>     ----------------------------------------------------------------------
--
>     *From:* gme-users-bounces at list.isis.vanderbilt.edu
>     [mailto:gme-users-bounces at list.isis.vanderbilt.edu] *On Behalf Of
>     *Yi Chu
>     *Sent:* Sunday, March 20, 2005 10:44 PM
>     *To:* Matthew J. Emerson; gme-users
>     *Subject:* Re: [gme-users] Redraw decorator when object attribute
>     changes
>
>     Hi Matthew,
>
>     Thank you very much. I tried a piece of code (modified from the
>     class for the UML) as follows in the Draw method of the decorator
>     class and it throws an exception #0x87650035. I don't know what this
>     exception code means.
>     ///////////////////////////////////////////////
>     CComPtr<IMgaFCO> mgaFco = m_mgaFco;
>     CComBSTR attr("test");    //the name of the Boolean type attribute
>     VARIANT_BOOL bVal;
>
>     try {
>          COMTHROW(mgaFco->get_BoolAttrByName(attr,&bVal));
>     }
>     catch (hresult_exception &ee) {
>         AfxMessageBox(ee.what());
>     }
>     ////////////////////////////////////////////
>
>     The only difference between my code and the UML class decorator code
>     is that the latter one is in the method Initialize(), while my code
>     is in Draw(). It seems that the value of the FCO's attribute can
>     only be retrieved during initialization of this decorator object.
>     But I want to let the decorator to display according to the
>     dynamically changed attribute value.
>
>     Any ideas?
>
>     Yi
>
>
>         ----- Original Message -----
>         *From:* Matthew J. Emerson <mailto:mjemerson at isis.vanderbilt.edu>
>         *To:* Yi Chu <mailto:y.chu at sympatico.ca> ; gme-users
>         <mailto:gme-users at list.isis.vanderbilt.edu>
>         *Sent:* Sunday, March 20, 2005 5:25 PM
>         *Subject:* RE: [gme-users] Redraw decorator when object
>         attribute changes
>
>         Hi Yi Chu,
>
>
>
>         I don’t much about decorators, but you might consider looking at
>         the decorator code for the UML class diagrams environment which
>         ships with GME. That decorator changes the visualization of each
>         Class instance to reflect the attribute names and types listed
>         in a string attribute.
>
>
>
>         --Matt
>
>
>
>         ------------------------------------------------------------------
------
>
>         *From:* Yi Chu [mailto:y.chu at sympatico.ca]
>         *Sent:* Sunday, March 20, 2005 1:31 PM
>         *To:* gme-users
>         *Subject:* [gme-users] Redraw decorator when object attribute
>         changes
>
>
>
>         Hello,
>
>
>
>         I wanted to change the shape of the decorator for an atom object
>         in my model according to the current value of an attribute. I am
>         thinking of using the Draw() method of the CDecorator class that
>         is generated with “decorkit.zip” to do the work. Is it possible
>         that I get access to the current object’s attribute in this
>         Draw() method? I tried to use “m_mgaFco->get_AttributeByName()”
>         but it seemed does not work for me.
>
>
>
>         Many thanks in advance.
>
>         */Yi Chu/*
>
>         ------------------------------------------------------------------
------
>
>         No virus found in this incoming message.
>         Checked by AVG Anti-Virus.
>         Version: 7.0.300 / Virus Database: 266.7.3 - Release Date:
3/15/2005
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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


-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.7.3 - Release Date: 3/15/2005




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.7.3 - Release Date: 3/15/2005



More information about the gme-users mailing list