Author Topic: Truncate text in shape  (Read 3350 times)

martin1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Truncate text in shape
« on: January 28, 2020, 07:30:20 pm »
Hi,
I display text using PrintWrapped in a custom shape script.
Is it somehow possible to truncate the text shown in the shape script, just for display purpose? The original text should be left untouched. To give an example, I only want to show the first 100 characters of a label.

Martin

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Truncate text in shape
« Reply #1 on: January 28, 2020, 10:16:36 pm »
No. Shape Script is very limited.

q.

martin1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Truncate text in shape
« Reply #2 on: January 28, 2020, 10:35:10 pm »
No. Shape Script is very limited.
I found out that I can request text from an addin function. So I could use that to read text from e.g. the Notes field, truncate it, and display the results in the shape. Hope that works?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Truncate text in shape
« Reply #3 on: January 28, 2020, 10:43:14 pm »
No. Shape Script is very limited.
I found out that I can request text from an addin function. So I could use that to read text from e.g. the Notes field, truncate it, and display the results in the shape. Hope that works?
That would work, but you would have to be very careful that it doesn't ruin the performance.
Schapescripts are executed very often and should be as quick as possible.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Truncate text in shape
« Reply #4 on: January 28, 2020, 10:46:06 pm »
And: they are interpreted and not compiled. If you have diagrams with lots of shape scripts to be executed you will appreciate a calm mind - ommm


q.

martin1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Truncate text in shape
« Reply #5 on: January 28, 2020, 11:54:21 pm »
I'll keep that in mind. Thanks!

martin1

  • EA User
  • **
  • Posts: 57
  • Karma: +0/-0
    • View Profile
Re: Truncate text in shape
« Reply #6 on: January 30, 2020, 08:40:51 pm »
Now I have implemented such a truncation via add in. Works fine performance wise on my machine for all "normal" diagrams. By normal I want to say that I didn't try out diagrams with several thousands of elements.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Truncate text in shape
« Reply #7 on: January 30, 2020, 08:51:56 pm »
So it's 10ths of elements, I guess.

q.

P.S. I just counted the elements in diagrams of a customer's model. It ranged from one to over 2000 to 1 with an average of 27. Astonishigly the 2000+ diagram was rendered rather smoothly and also the scrolling was ok. I think that's for the reason it was an auto-layout with a looong element band and it showed only 20 or so on a single page.
« Last Edit: January 30, 2020, 10:08:33 pm by qwerty »