Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: hansmaiser on March 10, 2006, 05:04:07 am

Title: Add an initial activity (StateNode) to diagram?
Post by: hansmaiser on March 10, 2006, 05:04:07 am
Hello,

I am trying to add an initial activity (StateNode) to an activity diagram, but it doesnt work.

Here my code example (VB6):

Dim objectDef As EA.Element
Dim diagramObject As EA.diagramObject

Set objectDef = package.Elements.AddNew("start", "StateNode")
objectDef.Update


Set diagramObject = diagram.DiagramObjects.AddNew("", "")
diagramObject.ElementID = objectDef.ElementID
diagramObject.Update


the result is a StateNode-object, but it is transparent and not black. What I am doing wrong?
Title: Re: Add an initial activity (StateNode) to diagram
Post by: «Midnight» on March 10, 2006, 06:34:33 am
It's buried in the reference guide; just where it should be, but you'll go mad searching for it.

Try setting the SubType = 100 for "ActivityInitial", or 101 for "ActivityFinal."

David
Title: Re: Add an initial activity (StateNode) to diagram
Post by: hansmaiser on March 10, 2006, 08:04:03 am
Hmm, I ve tried it, but it didnt work:

Dim objectDef As EA.Element
Dim diagramObject As EA.diagramObject

Set objectDef = package.Elements.AddNew("start", "StateNode")
objectDef.subtype = 100
objectDef.Update


Set diagramObject = diagram.DiagramObjects.AddNew("", "")
diagramObject.ElementID = objectDef.ElementID
diagramObject.Update


Where can I find the reference guide?
Title: Re: Add an initial activity (StateNode) to diagram
Post by: «Midnight» on March 10, 2006, 08:07:47 am
Hi Hans,

Look at section 15.1.2.5.3 - Automation, [stuff], Reference, Element, Element.

As to the exact syntax, I remember doing something when I first solved this problem, but I cannot remember exactly what. The code base I used at the time is in an archive, but I'll look it up for you.

David
Title: Re: Add an initial activity (StateNode) to diagram
Post by: hansmaiser on March 10, 2006, 08:21:54 am
Ok, Ive found it. You meant the help contents from ea...

Thanks, it works now