Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: alvinhsieh on September 19, 2006, 10:42:52 pm
-
For f = 0 To elm.Attributes.count - 1
Set att = elm.Attributes.GetAt(d)
att.Scale="10"
Next
,
i can print att.scale ,but can't setting it ?
please help me
thanks
-
You may need to do att.Update()
-
VB6 can't recognize This line' att.scale ="10" '
But,in debug windows i can print att.scale.
-
It's probably an integer?
-
in help->
mk:@MSITStore:C:\Program%20Files\Sparx%20Systems\EA\EA.chm::/attribute.htm
scale attribute is String
'Scale String Read/Write. Scale value. '
this problem seem come from VB6 ,because in design time VB6 IDE 'att.scale ="10"' will turn to red.
-
Despite of the help: did you try to assign an integer?
-
Set att = Elm.Attributes.GetAt(f)
att.Update
att.Scale =1
assign integer ,result is same.
-
Remember to call att.Update() again after the assignment, otherwise EA will silently ignore the new value.
-
Looks like the interface definition from Sparx is not right (can't remember the suffix of those files) as VB complains about the wrong type. Did anyone from Sparx try this sample, Neil?
-
VB seems to be expecting the syntax for its own built-in Scale method, i.e.:
object.Scale (x1,y1) - (x2,y2)
This is why it complains & asks for a bracket.
This is clearly a bug. Sparx guys: is there a fix for this?
-
You should submit this as a bug to Sparx directly. The help entry for the Scale property does not appear to be corrected through build 812 (EA &.0 beta 3) inclusive.
You can find the correct form by clicking the Support link at the top of any forum page, then clicking Bug Report in the left side menu. Or from the EA main menu choose Help | On-line Resources | Bug Report Page.
David
-
I don't think this is a problem with EA's interface. The problem here is that 'Scale' is unfortunately a keyword in VB. To get around this, put square brackets around Scale and it should work.
e.g. attrib.[Scale] = 1
-
Yep, that would likely help...
-
I don't think this is a problem with EA's interface. The problem here is that 'Scale' is unfortunately a keyword in VB. To get around this, put square brackets around Scale and it should work.
e.g. attrib.[Scale] = 1
Thanks for that. It works perfectly. :)
I didn't know you could do that in VB!!!
Well done.
Cheers,
Paul
-
N.B. In Perl (I also learned from Sparx) you have to use braces like $attrib->{Scale} = 1 to make an assignment while $attrib->Scale also legally prints the contents. I did not know that Perl and VB are so related ;)