[gme-users] Interpreter (Add-On) problem setting registry value

Florian Kraus florian.kraus at ils.uni-stuttgart.de
Fri Jan 23 06:32:35 CST 2015


Hello everyone,

 

We have an issue with GME-Interpreter working as Add-On.

 

What we want to do:

Set an Objects Registry-Value “nameColor” according to this Objects
Attribute named “Color”.

 

Problem:

It works fine for the FIRST time, but when we change the Attribute a second
time, nothing happens (the Interpreter doesn’t start at all).

After restarting GME it works, but again just for one time.

 

You’ll find our Interpreter-Code attached.

 

Note:

If we comment the lines where Registry is set, the Interpreter works even
several times (but nothing happens in the model for sure).

otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xff0000");

 

 

Any idea?

Thanks in advance.

 

Florian

 

 

---------

Dipl.-Ing. Florian Kraus

Institut für Luftfahrtsysteme (ILS)

Universität Stuttgart

Pfaffenwaldring 31

70569 Stuttgart (Vaihingen)

 

Tel.: +49 (0)711 685-67004

Fax: +49 (0)711 685-63591

Email:  <mailto:florian.kraus at ils.uni-stuttgart.de>
florian.kraus at ils.uni-stuttgart.de

URL:  <http://www.ils.uni-stuttgart.de> http://www.ils.uni-stuttgart.de

 

 

 

 

 

 

 

____________________________________________________________________________
_______

Code:

 

// ====================================================

// If the component is an Add-On, then this method is called for every
Object Event

 

void Component::objectEventPerformed( Object& object, unsigned long event,
VARIANT v )

{

       // ======================

       // Insert application specific code here

             std::string MetaName;

             std::string InterfaceColor;

             char anyChar[65];

       _itoa(event, anyChar, 16);

 

       using namespace GMEConsole;

       Console::Out::WriteLine(CString("Interpreter startet") + CString(" -
event:") + CString(anyChar));

 

       if(event == 0x00000001){ 

             ObjectStatus Status;

             Status = object->getStatus();

             if (Status == OST_Deleted){

                    goto cancel;

             }

                    

                    if (event == MON::OET_AttributeChanged){

                           MetaName = object->getObjectMeta().name();

                           Console::Out::WriteLine(MetaName.c_str());

                           if (MetaName == "MyAtom" ) {

                                  BON::FCO otherFCO(object);

                                  InterfaceColor =
otherFCO->getAttribute("Color")->getStringValue();

                                  if (InterfaceColor == "RED") {

 
otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xff0000");

                                  }

                                  if (InterfaceColor == "YELLOW") {

 
otherFCO->getRegistry()->setValueByPath("/nameColor" , "0xffff00");

                                  }

                                  if (InterfaceColor == "BLUE") {

 
otherFCO->getRegistry()->setValueByPath("/nameColor" , "0x0000ff");

                                  }

                           }

                           

                    }

                    

cancel:

Console::Out::WriteLine(CString("Interpreter stopped"));

       

 

       }

 

}

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20150123/43a84ebf/attachment.html 


More information about the gme-users mailing list