Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Paolo F Cantoni on November 23, 2010, 06:42:31 pm

Title: Selection information is unavailable on hidden
Post by: Paolo F Cantoni on November 23, 2010, 06:42:31 pm
The full text of the message is:
Selection information is unavailable on hidden diagrams

Anyone know what causes it (or even what it exactly means)?  

I can't yet reliably reproduce it and it stops my Add-In dead in its tracks when I'm trying to process a number of elements in a batch.

TIA,
Paolo
Title: Re: Selection information is unavailable on hidden
Post by: Ondrej Kolenaty on November 23, 2010, 07:16:45 pm
Hi,

  I guess You have used the Diagram property SelectedObjects, use DiagramObjects instead. Or explain the situation while getting the error better - piece of code would be also fine.
Title: Re: Selection information is unavailable on hidden
Post by: Paolo F Cantoni on November 24, 2010, 12:18:19 pm
Quote
Hi,

  I guess You have used the Diagram property SelectedObjects, use DiagramObjects instead. Or explain the situation while getting the error better - piece of code would be also fine.
Hi Ondrej,

Thanks for the somewhat tautological response...   ;)

The problem is that the Use Case requires the ability to select objects on a digram and then process them...

As I process the selected objects, I create new diagrams and lay them out.  Somewhere after the 5 such diagram, the bug is generated.

In thinking about the problem the only place where I do a selected objects is on the starting diagram.  Then, it struck me - having now got somewhat used to EAUI (EA's Unique Interface) I had a brain wave about what the problem might be - ran an experiment and voila the problem exposed...

As usual in EAUI the error message is somewhat spurious.  The bug is generated when the original selection diagram is forced off the visible workspace by the subsequent diagrams.  While the tab (for the selection diagram) is visible at the bottom of the work area, the automation proceeds correctly.  As soon as the tab disappears to the left, the bug is triggered.  EA incorrectly believes the digram is hidden and for reasons of its own decides that it shan't return selection information for the objects that are STILL selected on that diagram.

Bug reported...

Paolo
Title: Re: Selection information is unavailable on hidden
Post by: Geert Bellekens on November 24, 2010, 04:51:07 pm
Hmm, another funny typical EA bug.
But the good news is that it should be easy enough to work around it.

Geert
Title: Re: Selection information is unavailable on hidden
Post by: alesliehughes on May 02, 2011, 12:53:01 pm
After a second diagram is opened, and focus is set to this new diagram,
The validation for SelectedObjects will fail (The error you are seeing).
If you call OpenDiagram before calling SelectedObjects, it will set the focus back to the origial diagram you are processing.

Sample code.
Repository.OpenDiagram(Diagram.Diagram_ID);
collection = Diagram.SelectedObjects

Alistair
Title: Re: Selection information is unavailable on hidden
Post by: Paolo F Cantoni on May 02, 2011, 02:55:39 pm
Quote
After a second diagram is opened, and focus is set to this new diagram,
The validation for SelectedObjects will fail (The error you are seeing).
[size=18]...[/size]
Hi Alistair,

Thanks for the response, but your assertion doesn't seem to accord with the observed behaviour (see post #3).  The problem ONLY seems to arise when the original diagram becomes "Hidden".  (As I recall) The number of diagrams before the fault is triggered depends upon the screen size and the length of the diagram names...

Paolo
Title: Re: Selection information is unavailable on hidden
Post by: alesliehughes on May 02, 2011, 04:05:17 pm
Quote
Quote
After a second diagram is opened, and focus is set to this new diagram,
The validation for SelectedObjects will fail (The error you are seeing).
[size=18]...[/size]
Hi Alistair,

Thanks for the response, but your assertion doesn't seem to accord with the observed behaviour (see post #3).  The problem ONLY seems to arise when the original diagram becomes "Hidden".  (As I recall) The number of diagrams before the fault is triggered depends upon the screen size and the length of the diagram names...

Paolo

Hidden in this context, just means that the diagram doesn't have focus.  I can assure you that I can reproduce the issue with only two diagrams.

Alistair.
Title: Re: Selection information is unavailable on hidden
Post by: Paolo F Cantoni on May 02, 2011, 08:48:51 pm
Quote
[size=18]...[/size]
Hidden in this context, just means that the diagram doesn't have focus.  I can assure you that I can reproduce the issue with only two diagrams.

Alistair.
And I can assure you that under automation, I observed the behaviour documented.    ;)

Seriously though - which version are you using for testing and are you using automation (with your fix) to open a large(ish)  number of diagrams?  Because I ALREADY had the code correctly written - the dialog was triggered as observed.  The loop worked fine until the original diagram "went under".

I agree that your point about making sure you had focus is correct, but did you test under the circumstances I described?

Paolo