Author Topic: Add an initial activity (StateNode) to diagram?  (Read 3454 times)

hansmaiser

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Add an initial activity (StateNode) to diagram?
« 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?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Add an initial activity (StateNode) to diagram
« Reply #1 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
No, you can't have it!

hansmaiser

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Add an initial activity (StateNode) to diagram
« Reply #2 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?

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: Add an initial activity (StateNode) to diagram
« Reply #3 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
No, you can't have it!

hansmaiser

  • EA Novice
  • *
  • Posts: 14
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Add an initial activity (StateNode) to diagram
« Reply #4 on: March 10, 2006, 08:21:54 am »
Ok, Ive found it. You meant the help contents from ea...

Thanks, it works now