Book a Demo

Author Topic: v15 – How to react to label visibility from shape script  (Read 5237 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
v15 – How to react to label visibility from shape script
« on: August 06, 2019, 12:26:01 pm »
The title says it.

Is it possible to react to a user attempting to set a label to be visible/invisible from shapescript?  When you "play" with labels, in a shapescript you apparently take control of the label, but I was wondering if you could interrogate the user setting for the label.

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #1 on: August 08, 2019, 09:48:55 am »
If the label isn't visible your script isn't called.

If it is, you can set hidelabel to make it invisible. But as previously discussed it's not recommended.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #2 on: August 08, 2019, 09:57:58 am »
If the label isn't visible your script isn't called.

If it is, you can set hidelabel to make it invisible. But as previously discussed it's not recommended.
Thanks, Eve,

It is the case, however, that the shapescript can declare the label to be visible (showlabel) and the user can't override - Yes?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #3 on: August 09, 2019, 08:43:02 am »
Not that I'm aware of. I believe that your script won't be called so there is no opportunity to call anything.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #4 on: August 09, 2019, 10:09:01 am »
Not that I'm aware of. I believe that your script won't be called so there is no opportunity to call anything.
The setting of the label visibility is initially controlled in sub main {}, so it is always called.  This may have changed with later versions (I'm currently looking at revising all our shapescripts in the light of the new environment), but I'm pretty sure it used to be that case that if I set showlabel() in main, the user couldn't override it.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #5 on: August 09, 2019, 12:10:48 pm »
That makes more sense. Didn't realising you were calling that from a main script.

I'm not sure what the behavior is calling showlabel. Especially in response to the diagram option to draw no labels at all. In general forcing something to be visible isn't a good user experience.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: v15 – How to react to label visibility from shape script
« Reply #6 on: August 09, 2019, 01:43:05 pm »
That makes more sense. Didn't realising you were calling that from a main script.

I'm not sure what the behavior is calling showlabel. Especially in response to the diagram option to draw no labels at all. In general forcing something to be visible isn't a good user experience.
FWIW, in typical EAUI, even if I force the label to be visible (in this case in response to a non-standard multiplicity - governed by the source and target sub-shapes); Diagram | Connectors | [ ] Suppress All Connector Labels and <Context Menu> | Visibility | Hide All Labels will suppress the label, however, <Context Menu> | Visibility | Set Label Visibility... will not allow the specific label to be set to not visible.


[/size]This behaviour is almost acceptable.  For this use case, I'd be happy for the user to control the visibility for the specific label, notwithstanding that the default action is to set it as visible.  We use "Crow's Foot" notation for Associations and so for standard multiplicities, we suppress the multiplicity label (Target Bottom Label).


Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!