Book a Demo

Author Topic: EA_OnOutputItemClicked and how to use it  (Read 4870 times)

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
EA_OnOutputItemClicked and how to use it
« on: February 06, 2009, 04:53:55 pm »
I want to be able to write messages to my output tab and place IDs there that can be package, element, or diagram IDs and have the EA_OnOutputItemClicked handler function automatically highlight the correct one in the project browser. Unfortunately, the code I wrote for this is not guaranteed to work. Am I right in thinking that IDs are not unique across the 3 types, that is (for example), a given element ID might also have the same value as an unrelated package ID?

Most of the time I am putting element IDs into the output tab so my EA_OnOutputItemClicked handler function tries to interpret them as that type and if it fails then it tries packages, and if that fails it tries diagrams. But this is not bullet proof.

The only way around this as far as I can see is to encode in the text string itself the type of the ID. Has anyone else had this problem and what did you do about it? :)
The things I make may be for others, but how I make them is for me.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #1 on: February 09, 2009, 10:12:27 am »
Can you use GUIDs? They are guaranteed to be different across elements, packages and diagrams...
The Sparx Team
[email protected]

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #2 on: February 09, 2009, 03:21:09 pm »
Cant use GUIDs, the paramater must be an interger.
The things I make may be for others, but how I make them is for me.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #3 on: February 09, 2009, 11:49:43 pm »
Neil,

This is an area where EA appears broken. It is not so much that the feature fails to work as documented, but that the original idea was incorrectly scoped.

At the very least there should be both GUID and ID versions of these functions. That way legacy code will be preserved, but future code would work across models.

David
No, you can't have it!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #4 on: February 10, 2009, 08:42:50 am »
As far as getting it to work with the way it is implemented, instead of putting an actual ID into that field, put an index into an array that records the type and ID you're interested in.

OilyRag

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #5 on: February 10, 2009, 10:03:18 am »
Ah yes - the classic "another level of indirection will solve all problems" trick.  ;D
The things I make may be for others, but how I make them is for me.

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: EA_OnOutputItemClicked and how to use it
« Reply #6 on: February 13, 2009, 06:23:31 am »
Quote
As far as getting it to work with the way it is implemented, instead of putting an actual ID into that field, put an index into an array that records the type and ID you're interested in.
Is that a 16 or 32 bit integer? Depending on the API call EA could be looking for either one, and the difference is sometimes enough to cause problems that are difficult to diagnose?
No, you can't have it!