Book a Demo

Author Topic: Add-In not allowing change of data  (Read 6238 times)

thomaskilian

  • Guest
Add-In not allowing change of data
« on: May 16, 2006, 02:55:05 pm »
Hi there,
maybe I should sleep one night over this, but it nearly drives me crazy. Inside an Add-In I create a new class using Element->AddNew ("name", "Class"). That works fine.
I also can add an inner class and it appears also nicely in the project view. NOW - when I try to populate the classes with attributes, these don't show in the PV. Only after I have F9'ed them. Would not be a big problem, BUT - when I try to edit the attributes after creating them, I get an error that I'm not allowed to change an lvalue (neither Name, nor Notes nor Default). Seems the object I have is r/o. It must be something very basic :-[

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Add-In not allowing change of data
« Reply #1 on: May 16, 2006, 04:30:26 pm »
I am really guessing here Thomas, but could the display issue be related to the Hierarchy View level settings on the main Tools / Options page?

As for the r/o thing, I have no idea. How are you trying to do the modification, through the add-in or the UI? Also, is "lvalue" what you are seeing in a message, or just finger trouble?

David
No, you can't have it!

thomaskilian

  • Guest
Re: Add-In not allowing change of data
« Reply #2 on: May 16, 2006, 11:44:08 pm »
Hi David,
I'm experiencing this using just the automation interface in the add-in. lvalue is the left hand side of an assignment. That is elem->Attribute->GetAt(0)->Name = "something" will complain. I must be doing something really stupid. Hopefully I'll find that this evening or I have to get support by Sparx.

Thanks anyway :)

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Add-In not allowing change of data
« Reply #3 on: May 17, 2006, 05:11:18 am »
Just making sure that I read it right Thomas.

Remember that GetAt() returns an (untyped) object. Depending on your programming language, you may (will probably) have to cast this in some way.

The various languages I use are strongly typed. No matter what I do I cannot directly assign a value to a property unless I retrieve the resulting object and then manipulate it in a later statement, or type it on the fly - which one often depends on the environment I'm working in.

HTH, David
No, you can't have it!

thomaskilian

  • Guest
Re: Add-In not allowing change of data
« Reply #4 on: May 17, 2006, 11:23:05 am »
Hi David,
I'm using something strongly untyped: Perl. So it's not a matter of casting. I start right now to play around. If I don't find the cause within the next hour, I'll shout for help :P

thomaskilian

  • Guest
Re: Add-In not allowing change of data
« Reply #5 on: May 17, 2006, 02:35:12 pm »
David, you got me! :o

Although Perl is strongly untyped there is an area where typing is needed. That's where you pass a name to an element. In that case you need to do the following.
Code: [Select]
$pck->{Name} = Variant(VT_BSTR||VT_ARRAY, "newName");
and NOT
Code: [Select]
$pck->{Name} = "String2";


Took me 4 hrs to find that plus 2 hours yesterday :-[

(Honestly speaking I hate Perl, it's just that you don't have to pay for it - and it runs on nearly all platforms I use. Unlike Rexx :'()

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Add-In not allowing change of data
« Reply #6 on: May 17, 2006, 02:42:17 pm »
Excellent Thomas!

While my idea was in the correct direction I would have taken just as long to find the solution. I would have put the first 3+ hours into experiementing with coercing the left-hand side into a different form, all to no effect.

I have the same love-hate relationship with Perl; all the more so with work on 6.0 seeming to be in limbo.

What about Python? It seems to work well, and development continues at a steady pace.

Remember that you can always get the .Net SDK (1.x or 2.0) from MS. Although the Visual Studio IDE is not included, the C# compiler is. It has always been free.

You can also download and install the Express languages in the various Visual Studio 2005 Express line - I believe there are 5 environments. MS has recently said they are making the one-year free license permanent. Of course SQL Server 2005 Express has been free since its release and MS has always said it will remain so.

Last but not least, Java environments get better every day, and several weren't too shabby to begin with.

More later,
David
No, you can't have it!

thomaskilian

  • Guest
Re: Add-In not allowing change of data
« Reply #7 on: May 17, 2006, 04:07:17 pm »
Hi David,
I played around with Python and found it rather convenient. But I'm not as frustraded as it could be to switch from Perl since it needs extra effort to learn the details. I'm not too far off that point, though.

I'll go to bed now since it works - at last :)